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__)
// use lzcnt on MSVC only on AVX2 capable CPU's that all have this BMI
// instruction
return __lzcnt64(x);
return __lzcnt64(input_num);
#elif defined(_M_X64) || defined(_M_ARM64)
unsigned long leading_zero;
// 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));
#endif
#elif __has_builtin(__builtin_clzll)
return static_cast<limb_t>(__builtin_clzll(x));
return static_cast<limb_t>(__builtin_clzll(input_num));
#else
// Unlike MSVC, clang and gcc recognize this implementation and replace
// it with the assembly instructions which are appropriate for the
// target (lzcnt or bsr + zero handling).
int n = 64;
for (; leading_zero > 0; leading_zero >>= 1)
for (; input_num > 0; input_num >>= 1)
--n;
return static_cast<limb_t>(n);
#endif