11 #ifndef __WSUTIL_BITS_CTZ_H__ 12 #define __WSUTIL_BITS_CTZ_H__ 21 #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 26 return __builtin_ctzll(x);
32 return 63 - __builtin_clzll(x);
41 static const guint8 table[32] = {
42 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
43 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
46 return table[((guint32)((x & -(gint32)x) * 0x077CB531U)) >> 27];
53 guint32 lo = (guint32) x;
56 return 32 + __ws_ctz32(hi);
58 return __ws_ctz32(lo);
62 __ws_ilog2_32(guint32 x)
65 static const guint8 table[32] = {
66 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
67 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
76 return table[((guint32)(x * 0x07C4ACDDU)) >> 27];
83 guint32 lo = (guint32) x;
86 return __ws_ilog2_32(lo);
88 return 32 + __ws_ilog2_32(hi);