diff --git a/py/smallint.h b/py/smallint.h
index 0e30a808562a450277f9a3c7d59f6803d2078df1..b9686be30a43c5abb5257532d3357a3d0184e1f3 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -31,6 +31,8 @@
 
 // Functions for small integer arithmetic
 
+#ifndef MP_SMALL_INT_MIN
+
 // In SMALL_INT, next-to-highest bits is used as sign, so both must match for value in range
 #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C
 
@@ -55,6 +57,8 @@
 
 #endif
 
+#endif
+
 #define MP_SMALL_INT_MAX ((mp_int_t)(~(MP_SMALL_INT_MIN)))
 
 bool mp_small_int_mul_overflow(mp_int_t x, mp_int_t y);