compilation fix.

This commit is contained in:
IRainman 2025-12-30 21:02:50 +03:00
parent 61c7b53ea2
commit f5d44c73e4

View File

@ -414,7 +414,7 @@ leading_zeroes(uint64_t input_num) noexcept {
#if defined(__AVX2__) #if defined(__AVX2__)
// use lzcnt on MSVC only on AVX2 capable CPU's that all have this BMI // use lzcnt on MSVC only on AVX2 capable CPU's that all have this BMI
// instruction // instruction
return __lzcnt64(x); return __lzcnt64(input_num);
#elif defined(_M_X64) || defined(_M_ARM64) #elif defined(_M_X64) || defined(_M_ARM64)
unsigned long leading_zero; unsigned long leading_zero;
// Search the mask data from most significant bit (MSB) // Search the mask data from most significant bit (MSB)
@ -425,13 +425,13 @@ leading_zeroes(uint64_t input_num) noexcept {
return static_cast<limb_t>(leading_zeroes_generic(input_num)); return static_cast<limb_t>(leading_zeroes_generic(input_num));
#endif #endif
#elif __has_builtin(__builtin_clzll) #elif __has_builtin(__builtin_clzll)
return static_cast<limb_t>(__builtin_clzll(x)); return static_cast<limb_t>(__builtin_clzll(input_num));
#else #else
// Unlike MSVC, clang and gcc recognize this implementation and replace // Unlike MSVC, clang and gcc recognize this implementation and replace
// it with the assembly instructions which are appropriate for the // it with the assembly instructions which are appropriate for the
// target (lzcnt or bsr + zero handling). // target (lzcnt or bsr + zero handling).
int n = 64; int n = 64;
for (; leading_zero > 0; leading_zero >>= 1) for (; input_num > 0; input_num >>= 1)
--n; --n;
return static_cast<limb_t>(n); return static_cast<limb_t>(n);
#endif #endif