Merge pull request #9432 from shuffle2/constexpr-error

BitUtils: initialize variables
This commit is contained in:
LC 2021-01-10 01:44:58 -05:00 committed by GitHub
commit 1f0e3371a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -369,7 +369,7 @@ constexpr int CountLeadingZeros(uint64_t value)
#elif defined(_MSC_VER) && defined(_M_ARM_64) #elif defined(_MSC_VER) && defined(_M_ARM_64)
return _CountLeadingZeros64(value); return _CountLeadingZeros64(value);
#elif defined(_MSC_VER) && defined(_M_X86_64) #elif defined(_MSC_VER) && defined(_M_X86_64)
unsigned long index; unsigned long index = 0;
return _BitScanReverse64(&index, value) ? 63 - index : 64; return _BitScanReverse64(&index, value) ? 63 - index : 64;
#else #else
int result = 64; int result = 64;
@ -389,7 +389,7 @@ constexpr int CountLeadingZeros(uint32_t value)
#elif defined(_MSC_VER) && defined(_M_ARM_64) #elif defined(_MSC_VER) && defined(_M_ARM_64)
return _CountLeadingZeros(value); return _CountLeadingZeros(value);
#elif defined(_MSC_VER) && defined(_M_X86_64) #elif defined(_MSC_VER) && defined(_M_X86_64)
unsigned long index; unsigned long index = 0;
return _BitScanReverse(&index, value) ? 31 - index : 32; return _BitScanReverse(&index, value) ? 31 - index : 32;
#else #else
int result = 32; int result = 32;