This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you faggots probably know the de bruijn trick to count trailing zeros: | |
inline int ctz32_retarded(uint32_t x) | |
{ | |
static const unsigned char debruijn_ctz32[32] = { | |
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, | |
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 | |
}; | |
return debruijn_ctz32[((x & -x) * 0x077CB531) >> 27]; | |
} |
NewerOlder