summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-12-27 23:33:34 +1100
committerDamien George <damien.p.george@gmail.com>2019-12-27 23:33:34 +1100
commitd56bc6e03d842b1a2c91c987ba936752d0c2fe1b (patch)
tree6bb7168ce4d67c5a8f484c82602eb3e31762276a
parent4c0176d13fbd99196c457cb38633040426efd758 (diff)
py/obj.h: Use 32-bit shift in MP_OBJ_NEW_QSTR calc for obj-repr D.
The qst value is always small enough to fit in 31-bits (even less) and using a 32-bit shift rather than a 64-bit shift reduces code size by about 300 bytes.
-rw-r--r--py/obj.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index b4ee91108..efeb14b43 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -178,7 +178,7 @@ static inline bool mp_obj_is_small_int(mp_const_obj_t o)
static inline bool mp_obj_is_qstr(mp_const_obj_t o)
{ return ((((uint64_t)(o)) & 0xffff000000000000) == 0x0002000000000000); }
#define MP_OBJ_QSTR_VALUE(o) ((((uint32_t)(o)) >> 1) & 0xffffffff)
-#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 1) | 0x0002000000000001))
+#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)(((uint64_t)(((uint32_t)(qst)) << 1)) | 0x0002000000000001))
#if MICROPY_PY_BUILTINS_FLOAT