aboutsummaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-01-25 16:03:05 +1100
committerDamien George <damien.p.george@gmail.com>2019-01-25 16:03:05 +1100
commit5089b3ffb6dbaacdd99176b0ed4ff0aeeddca4d1 (patch)
tree2c5f87376452245ae25d34b53b112974ff5f0c08 /py/obj.h
parentacd647100b0fb02aab32500c4a3ffd0faceae7e8 (diff)
py/obj.h: Explicitly cast args to uint32_t in MP_OBJ_FUN_MAKE_SIG.
For architectures where size_t is less than 32 bits (eg 16 bits) the args must be casted to uint32_t so the left shift will work. For architectures where size_t is greater than 32 bits (eg 64 bits) this new casting will not lose any bits because the end result must anyway fit in a uint32_t.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index 1e37abca6..5eed90b0a 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -278,7 +278,7 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
#define MP_DECLARE_CONST_FUN_OBJ_KW(obj_name) extern const mp_obj_fun_builtin_var_t obj_name
#define MP_OBJ_FUN_ARGS_MAX (0xffff) // to set maximum value in n_args_max below
-#define MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, takes_kw) (((n_args_min) << 17) | ((n_args_max) << 1) | ((takes_kw) ? 1 : 0))
+#define MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, takes_kw) ((uint32_t)((((uint32_t)(n_args_min)) << 17) | (((uint32_t)(n_args_max)) << 1) | ((takes_kw) ? 1 : 0)))
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) \
const mp_obj_fun_builtin_fixed_t obj_name = \