mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-11 08:10:59 +00:00
Replace __builtin_clz() and __builtin_clzll() with some straight forward solution
This commit is contained in:
parent
fe66714fd7
commit
ce337c5863
12
src/shared.c
12
src/shared.c
@ -9,12 +9,20 @@
|
|||||||
|
|
||||||
static inline int get_msb32 (const u32 v)
|
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)
|
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)
|
bool overflow_check_u32_add (const u32 a, const u32 b)
|
||||||
|
Loading…
Reference in New Issue
Block a user