MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_ctz32

Function mi_ctz32

3rd/mimalloc-2.0.9/include/mimalloc-internal.h:990–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

988
989#else
990static inline size_t mi_ctz32(uint32_t x) {
991 // de Bruijn multiplication, see <http://supertech.csail.mit.edu/papers/debruijn.pdf>
992 static const unsigned char debruijn[32] = {
993 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
994 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
995 };
996 if (x==0) return 32;
997 return debruijn[((x & -(int32_t)x) * 0x077CB531UL) >> 27];
998}
999static inline size_t mi_clz32(uint32_t x) {
1000 // de Bruijn multiplication, see <http://supertech.csail.mit.edu/papers/debruijn.pdf>
1001 static const uint8_t debruijn[32] = {

Callers 1

mi_ctzFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected