From 0e557facb93425e791a23a6695b202e467a60026 Mon Sep 17 00:00:00 2001 From: stijn Date: Thu, 30 Oct 2014 14:39:22 +0100 Subject: 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. --- py/mpz.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'py/mpz.c') 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. -- cgit v1.2.3