summaryrefslogtreecommitdiff
path: root/py/objint_mpz.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-09-06 19:17:23 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-09-06 20:22:06 +0300
commit722e562736f83865333d8b3dd942f903b9db8a7c (patch)
tree5aa17b165bd8393e5add7f6150c9ef09d984c88c /py/objint_mpz.c
parent17598d49e1091e2745d8f01288f95007189cdcf5 (diff)
py: Correctly set sys.maxsize value for 64-bit.
Type representing signed size doesn't have to be int, so use special value which defaults to SSIZE_MAX, but as it's not defined by C standard (but rather by POSIX), allow ports to set it.
Diffstat (limited to 'py/objint_mpz.c')
-rw-r--r--py/objint_mpz.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 20fba00bf..440b4f318 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -47,14 +47,14 @@
// Export value for sys.maxsize
#define DIG_MASK ((1L << MPZ_DIG_SIZE) - 1)
STATIC const mpz_dig_t maxsize_dig[MPZ_NUM_DIG_FOR_INT] = {
- (INT_MAX >> MPZ_DIG_SIZE * 0) & DIG_MASK,
- #if (INT_MAX >> MPZ_DIG_SIZE * 0) > DIG_MASK
- (INT_MAX >> MPZ_DIG_SIZE * 1) & DIG_MASK,
- #if (INT_MAX >> MPZ_DIG_SIZE * 1) > DIG_MASK
- (INT_MAX >> MPZ_DIG_SIZE * 2) & DIG_MASK,
- (INT_MAX >> MPZ_DIG_SIZE * 3) & DIG_MASK,
- (INT_MAX >> MPZ_DIG_SIZE * 4) & DIG_MASK,
-// (INT_MAX >> MPZ_DIG_SIZE * 5) & DIG_MASK,
+ (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 0) & DIG_MASK,
+ #if (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 0) > DIG_MASK
+ (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 1) & DIG_MASK,
+ #if (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 1) > DIG_MASK
+ (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 2) & DIG_MASK,
+ (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 3) & DIG_MASK,
+ (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 4) & DIG_MASK,
+// (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 5) & DIG_MASK,
#endif
#endif
};