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.
This commit is contained in:
stijn
2014-10-30 14:39:22 +01:00
committed by Damien George
parent e62a0fe367
commit 0e557facb9
3 changed files with 11 additions and 5 deletions

View File

@@ -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.