diff options
author | Damien George <damien.p.george@gmail.com> | 2016-01-07 14:45:57 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-01-07 16:21:07 +0000 |
commit | 47dc5922cab047003acbdb404b9e151f343f9679 (patch) | |
tree | 8232fbe7e27f2e48244c63b4ac81b65e6a92580f | |
parent | 22b2265053ef9fec4b1aedab770b32f71b0c85f7 (diff) | |
download | micropython-47dc5922cab047003acbdb404b9e151f343f9679.tar.gz micropython-47dc5922cab047003acbdb404b9e151f343f9679.zip |
py/inlinethumb: Allow assembler to use big ints as args to instructions.
-rw-r--r-- | py/emitinlinethumb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c index 84366003ea..854b1460dd 100644 --- a/py/emitinlinethumb.c +++ b/py/emitinlinethumb.c @@ -298,12 +298,13 @@ bad_arg: return 0; } -STATIC int get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, int fit_mask) { - if (!MP_PARSE_NODE_IS_SMALL_INT(pn)) { +STATIC uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, uint32_t fit_mask) { + mp_obj_t o; + if (!mp_parse_node_get_int_maybe(pn, &o)) { emit_inline_thumb_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, "'%s' expects an integer", op)); return 0; } - int i = MP_PARSE_NODE_LEAF_SMALL_INT(pn); + uint32_t i = mp_obj_get_int_truncated(o); if ((i & (~fit_mask)) != 0) { emit_inline_thumb_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, "'%s' integer 0x%x does not fit in mask 0x%x", op, i, fit_mask)); return 0; |