summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-01-08 13:43:56 +0000
committerDamien George <damien.p.george@gmail.com>2016-01-08 13:43:56 +0000
commitc1c57eafac684f961923f601162bce1b19237003 (patch)
tree7381358960a3ecf9e4386acaf247a75a56e8ea5b
parent1fa6be52646f015b28abc0f1535af7bc4ffb647d (diff)
downloadmicropython-c1c57eafac684f961923f601162bce1b19237003.tar.gz
micropython-c1c57eafac684f961923f601162bce1b19237003.zip
py/smallint: Allow to override MP_SMALL_INT_MIN et al.
This allows a port to specify exactly how many bits are in a small int (eg for a uPy bytecode cross compiler).
-rw-r--r--py/smallint.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/smallint.h b/py/smallint.h
index 0e30a80856..b9686be30a 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);