BitUtils: initialize variables

fixes C3615 on some msvc/cmake configs
This commit is contained in:
Shawn Hoffman 2021-01-09 22:18:29 -08:00
parent 0776263c5e
commit 1e5e5ea855

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;