diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2019-06-01 21:30:03 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2019-12-31 22:19:18 +0200 |
commit | 412791486dfb430219d8e30bcbebbfc57a99484a (patch) | |
tree | 575300d1a7abbf51559d78b3da58e4653822eb97 | |
parent | liblzma: Use unaligned_readXXne functions instead of type punning. (diff) | |
download | xz-412791486dfb430219d8e30bcbebbfc57a99484a.tar.xz |
tuklib_integer: Cleanup MSVC-specific code.
-rw-r--r-- | src/common/tuklib_integer.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/common/tuklib_integer.h b/src/common/tuklib_integer.h index e2c7b7c8..1524c61e 100644 --- a/src/common/tuklib_integer.h +++ b/src/common/tuklib_integer.h @@ -546,11 +546,9 @@ bsr32(uint32_t n) __asm__("bsrl %1, %0" : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - // MSVC isn't supported by tuklib, but since this code exists, - // it doesn't hurt to have it here anyway. - uint32_t i; - _BitScanReverse((DWORD *)&i, n); +#elif defined(_MSC_VER) + unsigned long i; + _BitScanReverse(&i, n); return i; #else @@ -600,9 +598,9 @@ clz32(uint32_t n) : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanReverse((DWORD *)&i, n); +#elif defined(_MSC_VER) + unsigned long i; + _BitScanReverse(&i, n); return i ^ 31U; #else @@ -650,9 +648,9 @@ ctz32(uint32_t n) __asm__("bsfl %1, %0" : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanForward((DWORD *)&i, n); +#elif defined(_MSC_VER) + unsigned long i; + _BitScanForward(&i, n); return i; #else |