split out windows longlong parts
This commit is contained in:
parent
08dc99d709
commit
059ea30181
55
longlong.h
55
longlong.h
@ -164,58 +164,9 @@ MA 02110-1301, USA. */
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
|
||||
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
|
||||
|
||||
# if defined( _WIN64 )
|
||||
|
||||
#pragma intrinsic(_BitScanForward64)
|
||||
#pragma intrinsic(_BitScanReverse64)
|
||||
#pragma intrinsic(_umul128)
|
||||
|
||||
# define count_leading_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanReverse64(&_z, (x)); \
|
||||
c = 63 - _z; \
|
||||
} while (0)
|
||||
# define count_trailing_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanForward64(&_z, (x)); \
|
||||
c = _z; \
|
||||
} while (0)
|
||||
# define umul_ppmm(xh, xl, m0, m1) \
|
||||
do { \
|
||||
xl = _umul128( (m0), (m1), &xh); \
|
||||
} while (0)
|
||||
# else
|
||||
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
#pragma intrinsic(__emulu)
|
||||
|
||||
# define count_leading_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanReverse(&_z, (x)); \
|
||||
c = 31 - _z; \
|
||||
} while (0)
|
||||
# define count_trailing_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanForward(&_z, (x)); \
|
||||
c = _z; \
|
||||
} while (0)
|
||||
# define umul_ppmm(xh, xl, m0, m1) \
|
||||
do { unsigned __int64 _t; \
|
||||
_t = __emulu( (m0), (m1)); \
|
||||
xl = _t & 0xffffffff; \
|
||||
xh = _t >> 32; \
|
||||
} while (0)
|
||||
# endif
|
||||
|
||||
/* temporary */
|
||||
#include "mpn/x86w/longlong.h"
|
||||
#include "mpn/x86_64w/longlong.h"
|
||||
#endif
|
||||
|
||||
/* FIXME: The macros using external routines like __MPN(count_leading_zeros)
|
||||
|
33
mpn/x86_64w/longlong.h
Normal file
33
mpn/x86_64w/longlong.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
|
||||
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
|
||||
|
||||
# if defined( _WIN64 )
|
||||
|
||||
#pragma intrinsic(_BitScanForward64)
|
||||
#pragma intrinsic(_BitScanReverse64)
|
||||
#pragma intrinsic(_umul128)
|
||||
|
||||
# define count_leading_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanReverse64(&_z, (x)); \
|
||||
c = 63 - _z; \
|
||||
} while (0)
|
||||
# define count_trailing_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanForward64(&_z, (x)); \
|
||||
c = _z; \
|
||||
} while (0)
|
||||
# define umul_ppmm(xh, xl, m0, m1) \
|
||||
do { \
|
||||
xl = _umul128( (m0), (m1), &xh); \
|
||||
} while (0)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* We need to put the the gcc inline asm for MinGW64 here as well */
|
||||
|
29
mpn/x86w/longlong.h
Normal file
29
mpn/x86w/longlong.h
Normal file
@ -0,0 +1,29 @@
|
||||
# include <intrin.h>
|
||||
|
||||
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
|
||||
|
||||
# if ! defined( _WIN64 )
|
||||
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
#pragma intrinsic(__emulu)
|
||||
|
||||
# define count_leading_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanReverse(&_z, (x)); \
|
||||
c = 31 - _z; \
|
||||
} while (0)
|
||||
# define count_trailing_zeros(c,x) \
|
||||
do { unsigned long _z; \
|
||||
ASSERT ((x) != 0); \
|
||||
_BitScanForward(&_z, (x)); \
|
||||
c = _z; \
|
||||
} while (0)
|
||||
# define umul_ppmm(xh, xl, m0, m1) \
|
||||
do { unsigned __int64 _t; \
|
||||
_t = __emulu( (m0), (m1)); \
|
||||
xl = _t & 0xffffffff; \
|
||||
xh = _t >> 32; \
|
||||
} while (0)
|
||||
# endif
|
Loading…
Reference in New Issue
Block a user