Replace __builtin_clz() and __builtin_clzll() with some straight forward solution

pull/1150/head
jsteube 7 years ago
parent fe66714fd7
commit ce337c5863

@ -9,12 +9,20 @@
static inline int get_msb32 (const u32 v)
{
return 32 - __builtin_clz (v);
int i;
for (i = 32; i > 0; i--) if ((v >> (i - 1)) & 1) break;
return i;
}
static inline int get_msb64 (const u64 v)
{
return 64 - __builtin_clzll (v);
int i;
for (i = 64; i > 0; i--) if ((v >> (i - 1)) & 1) break;
return i;
}
bool overflow_check_u32_add (const u32 a, const u32 b)

Loading…
Cancel
Save