mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
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:
6
py/mpz.c
6
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.
|
||||
|
||||
Reference in New Issue
Block a user