add bswap limb definitions to MSVC longlong_inc.h versions

This commit is contained in:
gladman 2011-04-30 08:47:19 +00:00
parent 3066b516d5
commit a7a7c79be7
2 changed files with 33 additions and 13 deletions

View File

@ -6,9 +6,10 @@
# if defined( _WIN64 )
#pragma intrinsic(_BitScanForward64)
#pragma intrinsic(_BitScanReverse64)
#pragma intrinsic(_umul128)
# pragma intrinsic(_BitScanForward64)
# pragma intrinsic(_BitScanReverse64)
# pragma intrinsic(_umul128)
# pragma intrinsic(_bswap64)
# define count_leading_zeros(c,x) \
do { unsigned long _z; \
@ -26,9 +27,15 @@
do { \
xl = _umul128( (m0), (m1), &xh); \
} while (0)
# endif
#endif /* _MSC_VER */
# if !defined( BSWAP_LIMB )
# define BSWAP_LIMB
# define BSWAP_LIMB(dst, src) dst = _bswap64(src)
# endif
# endif /* _WIN64 */
#endif /* _MSC_VER */
/* We need to put the the gcc inline asm for MinGW64 here as well */
@ -88,5 +95,12 @@ MA 02110-1301, USA. */
__asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x))); \
} while (0)
#if !defined(BSWAP_LIMB)
#define BSWAP_LIMB
#define BSWAP_LIMB(dst, src) \
do { \
__asm__ ("bswap %q0" : "=r" (dst) : "0" (src)); \
} while (0)
#endif
#endif

View File

@ -1,16 +1,16 @@
#ifdef _MSC_VER
# include <intrin.h>
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
# define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
# if ! defined( _WIN64 )
# if !defined( _WIN64 )
#pragma intrinsic(_BitScanForward)
#pragma intrinsic(_BitScanReverse)
#pragma intrinsic(__emulu)
# pragma intrinsic(_BitScanForward)
# pragma intrinsic(_BitScanReverse)
# pragma intrinsic(__emulu)
# pragma intrinsic(_bswap)
# define count_leading_zeros(c,x) \
do { unsigned long _z; \
@ -30,6 +30,12 @@
xl = _t & 0xffffffff; \
xh = _t >> 32; \
} while (0)
# endif
#endif /* _MSC_VER */
# if !defined( BSWAP_LIMB )
# define BSWAP_LIMB
# define BSWAP_LIMB(dst, src) dst = _bswap(src)
# endif
# endif /* _WIN64 */
#endif /* _MSC_VER */