oh

221 阅读1分钟

try runing this,you will be fun, please trust me.

/*
 * ilog2 - return floor(log base 2 of x), where x > 0
 *   Example: ilog2(16) = 4
 *   Legal ops: ! ~ & ^ | + << >>
 *   Max ops: 90
 *   Rating: 4
 */
int ilog2(int x) {
  int ans = (!(x >> 16)) << 4;
  ans ^= (!(x << ans >> 24)) << 3;
  ans ^= 28;
  ans ^= (!(x >> ans)) << 2;
  x = x >> ans;
  ans ^= ((~0x5B) >> (x & 30)) & 3;
  return ans;
}