28 #ifndef V8_COMPILER_INTRINSICS_H_
29 #define V8_COMPILER_INTRINSICS_H_
50 return __builtin_ctz(value);
54 return __builtin_clz(value);
58 return __builtin_popcount(value);
61 #elif defined(_MSC_VER)
63 #pragma intrinsic(_BitScanForward)
64 #pragma intrinsic(_BitScanReverse)
68 _BitScanForward(&result, static_cast<long>(value));
69 return static_cast<int>(result);
74 _BitScanReverse(&result, static_cast<long>(value));
75 return 31 -
static_cast<int>(result);
80 value = ((value >> 1) & 0x55555555) + (value & 0x55555555);
81 value = ((value >> 2) & 0x33333333) + (value & 0x33333333);
82 value = ((value >> 4) & 0x0f0f0f0f) + (value & 0x0f0f0f0f);
83 value = ((value >> 8) & 0x00ff00ff) + (value & 0x00ff00ff);
84 value = ((value >> 16) & 0x0000ffff) + (value & 0x0000ffff);
89 #error Unsupported compiler
94 #endif // V8_COMPILER_INTRINSICS_H_
int CountLeadingZeros(uint64_t value, int width)
int CountSetBits(uint64_t value, int width)
INLINE(static int CountTrailingZeros(uint32_t value))
int CountTrailingZeros(uint64_t value, int width)