summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2017-01-15 16:25:40 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2017-01-15 16:28:16 +1100
commitf60a8ccc5c04fd053bb3192ad794ec49f2dc9d9f (patch)
treeb3a9321b2c5cab21783a70f143cb1f5f479a8f02
parentd178058028050aeec649c85644cc9eed08f0aa37 (diff)
downloadflac-f60a8ccc5c04fd053bb3192ad794ec49f2dc9d9f.tar.gz
bitmath.h: MSVS unsigned fix
The orignal code had `unsigned long` inside `#ifdef MSVC`. It was then changed to `uint64_t` which was incorrect because on Windows `sizze long == 4`. Change it now to `uint32_t` which is always correct regardless of OS, compiler or architecture.
-rw-r--r--src/libFLAC/include/private/bitmath.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libFLAC/include/private/bitmath.h b/src/libFLAC/include/private/bitmath.h
index d9117b63..12a3fb90 100644
--- a/src/libFLAC/include/private/bitmath.h
+++ b/src/libFLAC/include/private/bitmath.h
@@ -82,7 +82,7 @@ static inline uint32_t FLAC__clz_uint32(FLAC__uint32 v)
return __builtin_clz(v);
#elif defined(_MSC_VER)
{
- uint64_t idx;
+ uint32_t idx;
_BitScanReverse(&idx, v);
return idx ^ 31U;
}
@@ -106,7 +106,7 @@ static inline uint32_t FLAC__clz_uint64(FLAC__uint64 v)
return __builtin_clzll(v);
#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
{
- uint64_t idx;
+ uint32_t idx;
_BitScanReverse64(&idx, v);
return idx ^ 63U;
}
@@ -160,7 +160,7 @@ static inline uint32_t FLAC__bitmath_ilog2(FLAC__uint32 v)
return _bit_scan_reverse(v);
#elif defined(_MSC_VER)
{
- uint64_t idx;
+ uint32_t idx;
_BitScanReverse(&idx, v);
return idx;
}
@@ -177,7 +177,7 @@ static inline uint32_t FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
/* Sorry, only supported in x64/Itanium.. and both have fast FPU which makes integer-only encoder pointless */
#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
{
- uint64_t idx;
+ uint32_t idx;
_BitScanReverse64(&idx, v);
return idx;
}