summaryrefslogtreecommitdiff
path: root/py/mpz.c
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2014-10-30 14:39:22 +0100
committerDamien George <damien.p.george@gmail.com>2014-10-30 23:00:24 +0000
commit0e557facb93425e791a23a6695b202e467a60026 (patch)
tree676380dea63edff840b6f6345466394478171255 /py/mpz.c
parente62a0fe36776f039149e7fab77323aa380b97c2e (diff)
mpz: Fix 64bit msvc build
msvc does not treat 1L a 64bit integer hence all occurences of shifting it left or right result in undefined behaviour since the maximum allowed shift count for 32bit ints is 31. Forcing the correct type explicitely, stored in MPZ_LONG_1, solves this.
Diffstat (limited to 'py/mpz.c')
-rw-r--r--py/mpz.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/mpz.c b/py/mpz.c
index b5cc7d183..fc1109fdd 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -37,9 +37,9 @@
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_MPZ
#define DIG_SIZE (MPZ_DIG_SIZE)
-#define DIG_MASK ((1L << DIG_SIZE) - 1)
-#define DIG_MSB (1L << (DIG_SIZE - 1))
-#define DIG_BASE (1L << DIG_SIZE)
+#define DIG_MASK ((MPZ_LONG_1 << DIG_SIZE) - 1)
+#define DIG_MSB (MPZ_LONG_1 << (DIG_SIZE - 1))
+#define DIG_BASE (MPZ_LONG_1 << DIG_SIZE)
/*
mpz is an arbitrary precision integer type with a public API.