summaryrefslogtreecommitdiff
path: root/py/smallint.h
diff options
context:
space:
mode:
Diffstat (limited to 'py/smallint.h')
-rw-r--r--py/smallint.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/smallint.h b/py/smallint.h
index 58d843e8a..67daf9b9f 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -37,7 +37,7 @@
#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C
#define MP_SMALL_INT_MIN ((mp_int_t)(((mp_int_t)MP_OBJ_WORD_MSBIT_HIGH) >> 1))
-#define MP_SMALL_INT_FITS(n) ((((n) ^ ((n) << 1)) & MP_OBJ_WORD_MSBIT_HIGH) == 0)
+#define MP_SMALL_INT_FITS(n) ((((n) ^ ((mp_uint_t)(n) << 1)) & MP_OBJ_WORD_MSBIT_HIGH) == 0)
// Mask to truncate mp_int_t to positive value
#define MP_SMALL_INT_POSITIVE_MASK ~(MP_OBJ_WORD_MSBIT_HIGH | (MP_OBJ_WORD_MSBIT_HIGH >> 1))