Update libdivide to the latest master

This commit is contained in:
Alexey Milovidov 2020-07-05 02:58:10 +03:00
parent c696354dd4
commit c5cf7199d8

View File

@ -290,10 +290,17 @@ static inline int32_t libdivide_count_leading_zeros32(uint32_t val) {
}
return 0;
#else
int32_t result = 0;
uint32_t hi = 1U << 31;
for (; ~val & hi; hi >>= 1) {
result++;
if (val == 0)
return 32;
int32_t result = 8;
uint32_t hi = 0xFFU << 24;
while ((val & hi) == 0) {
hi >>= 8;
result += 8;
}
while (val & hi) {
result -= 1;
hi <<= 1;
}
return result;
#endif