From c20b45027e8288114fd6ee33f99218440b60da77 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 13 Jul 2014 22:21:58 +0200 Subject: [PATCH] liblzma: Port to VS 6, 7.0 Also remove use of MSVC intrinsic. --- Utilities/cmliblzma/common/sysdefs.h | 10 ++++++++++ Utilities/cmliblzma/common/tuklib_integer.h | 17 ----------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 5beda5c2e..7481e3def 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -16,6 +16,10 @@ #ifndef LZMA_SYSDEFS_H #define LZMA_SYSDEFS_H +#if defined(_MSC_VER) +# pragma warning(disable: 4028 4244 4761) +#endif + ////////////// // Includes // ////////////// @@ -46,6 +50,12 @@ # include #endif + +#if defined(_MSC_VER) && (_MSC_VER < 1310) +# define UINT64_C(n) n ## ui64 +#endif + + // Be more compatible with systems that have non-conforming inttypes.h. // We assume that int is 32-bit and that long is either 32-bit or 64-bit. // Full Autoconf test could be more correct, but this should work well enough. diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h index 1897438aa..5e8262a11 100644 --- a/Utilities/cmliblzma/common/tuklib_integer.h +++ b/Utilities/cmliblzma/common/tuklib_integer.h @@ -387,13 +387,6 @@ 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); - return i; - #else uint32_t i = 31; @@ -441,11 +434,6 @@ clz32(uint32_t n) : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanReverse((DWORD *)&i, n); - return i ^ 31U; - #else uint32_t i = 0; @@ -491,11 +479,6 @@ 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); - return i; - #else uint32_t i = 0;