diff --git a/mpn/x86_64w/longlong_inc.h b/mpn/x86_64w/longlong_inc.h index 78ed993a..15cce425 100644 --- a/mpn/x86_64w/longlong_inc.h +++ b/mpn/x86_64w/longlong_inc.h @@ -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 diff --git a/mpn/x86w/longlong_inc.h b/mpn/x86w/longlong_inc.h index a7a68742..455208f3 100644 --- a/mpn/x86w/longlong_inc.h +++ b/mpn/x86w/longlong_inc.h @@ -1,16 +1,16 @@ - #ifdef _MSC_VER # include -#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 */