@Test public void fls() throws Exception { assertThat(DvbMath.fls(1), is(1)); assertThat(DvbMath.fls(0), is(0)); assertThat(DvbMath.fls(0x80000000), is(32)); }
static int fls(int x) { if (x == 0) return 0; int r = 32; if ((x & 0xffff0000L) == 0) { x <<= 16; r -= 16; } if ((x & 0xff000000L) == 0) { x <<= 8; r -= 8; } if ((x & 0xf0000000L) == 0) { x <<= 4; r -= 4; } if ((x & 0xc0000000L) == 0) { x <<= 2; r -= 2; } if ((x & 0x80000000L) == 0) { r -= 1; } return r; }
DvbMath { static int fls(int x) { if (x == 0) return 0; int r = 32; if ((x & 0xffff0000L) == 0) { x <<= 16; r -= 16; } if ((x & 0xff000000L) == 0) { x <<= 8; r -= 8; } if ((x & 0xf0000000L) == 0) { x <<= 4; r -= 4; } if ((x & 0xc0000000L) == 0) { x <<= 2; r -= 2; } if ((x & 0x80000000L) == 0) { r -= 1; } return r; } }
DvbMath { static int fls(int x) { if (x == 0) return 0; int r = 32; if ((x & 0xffff0000L) == 0) { x <<= 16; r -= 16; } if ((x & 0xff000000L) == 0) { x <<= 8; r -= 8; } if ((x & 0xf0000000L) == 0) { x <<= 4; r -= 4; } if ((x & 0xc0000000L) == 0) { x <<= 2; r -= 2; } if ((x & 0x80000000L) == 0) { r -= 1; } return r; }  }
DvbMath { static int fls(int x) { if (x == 0) return 0; int r = 32; if ((x & 0xffff0000L) == 0) { x <<= 16; r -= 16; } if ((x & 0xff000000L) == 0) { x <<= 8; r -= 8; } if ((x & 0xf0000000L) == 0) { x <<= 4; r -= 4; } if ((x & 0xc0000000L) == 0) { x <<= 2; r -= 2; } if ((x & 0x80000000L) == 0) { r -= 1; } return r; }  static int intlog10(int value); static long divU64(long dividend, long divisor); static long divRoundClosest(long x, long divisor); }
DvbMath { static int fls(int x) { if (x == 0) return 0; int r = 32; if ((x & 0xffff0000L) == 0) { x <<= 16; r -= 16; } if ((x & 0xff000000L) == 0) { x <<= 8; r -= 8; } if ((x & 0xf0000000L) == 0) { x <<= 4; r -= 4; } if ((x & 0xc0000000L) == 0) { x <<= 2; r -= 2; } if ((x & 0x80000000L) == 0) { r -= 1; } return r; }  static int intlog10(int value); static long divU64(long dividend, long divisor); static long divRoundClosest(long x, long divisor);  }