summaryrefslogtreecommitdiffstatshomepage
path: root/py/smallint.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-10-17 23:20:57 +0100
committerDamien George <damien.p.george@gmail.com>2015-10-20 12:38:54 +0100
commit183edefddd8c08dd989fa7bec2d33d8b4130e1dc (patch)
tree530b4807c22868f556da2ce87f987e38bded7c25 /py/smallint.h
parentaedb8591778a8dc4097eb4ffd2891dd5730efdde (diff)
downloadmicropython-183edefddd8c08dd989fa7bec2d33d8b4130e1dc.tar.gz
micropython-183edefddd8c08dd989fa7bec2d33d8b4130e1dc.zip
py: Add object repr "C", where 30-bit floats are stuffed in obj word.
This new object representation puts floats into the object word instead of on the heap, at the expense of reducing their precision to 30 bits. It only makes sense when the word size is 32-bits.
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 19b5209ec7..d9e53ee361 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -32,7 +32,7 @@
// Functions for small integer arithmetic
// 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
+#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)WORD_MSBIT_HIGH) >> 1))
#define MP_SMALL_INT_FITS(n) ((((n) ^ ((n) << 1)) & WORD_MSBIT_HIGH) == 0)