- return CountTrailingZeros_32(~Value);
-}
-
-/// CountTrailingZeros_64 - This function performs the platform optimal form
-/// of counting the number of zeros from the least significant bit to the first
-/// one bit (64 bit edition.)
-/// Returns 64 if the word is zero.
-inline unsigned CountTrailingZeros_64(uint64_t Value) {
-#if __GNUC__ >= 4
- return Value ? __builtin_ctzll(Value) : 64;
-#else
- static const unsigned Mod67Position[] = {
- 64, 0, 1, 39, 2, 15, 40, 23, 3, 12, 16, 59, 41, 19, 24, 54,
- 4, 64, 13, 10, 17, 62, 60, 28, 42, 30, 20, 51, 25, 44, 55,
- 47, 5, 32, 65, 38, 14, 22, 11, 58, 18, 53, 63, 9, 61, 27,
- 29, 50, 43, 46, 31, 37, 21, 57, 52, 8, 26, 49, 45, 36, 56,
- 7, 48, 35, 6, 34, 33, 0
- };
- // Replace "-Value" by "1+~Value" in the following commented code to avoid
- // MSVC warning C4146
- // return Mod67Position[(-Value & Value) % 67];
- return Mod67Position[((1 + ~Value) & Value) % 67];
-#endif