mirror of
https://github.com/lemire/fast_double_parser.git
synced 2025-04-03 20:04:57 +00:00
Fixing legacy Win32 support
This commit is contained in:
parent
182c61b1ce
commit
3b296fc600
1 changed files with 8 additions and 4 deletions
|
@ -202,10 +202,14 @@ inline int leading_zeroes(uint64_t input_num) {
|
|||
else
|
||||
return 64;
|
||||
#else
|
||||
unsigned long x1 = (unsigned long)(input_num >> 32), top, bottom;
|
||||
_BitScanReverse(&top, x1);
|
||||
_BitScanReverse(&bottom, (unsigned long)input_num);
|
||||
return x1 ? top + 32 : bottom;
|
||||
int last_bit = 0;
|
||||
if(input_num & uint64_t(0xffffffff00000000)) input_num >>= 32, last_bit |= 32;
|
||||
if(input_num & uint64_t( 0xffff0000)) input_num >>= 16, last_bit |= 16;
|
||||
if(input_num & uint64_t( 0xff00)) input_num >>= 8, last_bit |= 8;
|
||||
if(input_num & uint64_t( 0xf0)) input_num >>= 4, last_bit |= 4;
|
||||
if(input_num & uint64_t( 0xc)) input_num >>= 2, last_bit |= 2;
|
||||
if(input_num & uint64_t( 0x2)) input_num >>= 1, last_bit |= 1;
|
||||
return 63 - last_bit;
|
||||
#endif // defined(_M_X64) || defined(_M_ARM64) || defined (_M_IA64)
|
||||
#else
|
||||
return __builtin_clzll(input_num);
|
||||
|
|
Loading…
Add table
Reference in a new issue