Skip to content

Commit 47dc592

Browse files
committed
py/inlinethumb: Allow assembler to use big ints as args to instructions.
1 parent 22b2265 commit 47dc592

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

py/emitinlinethumb.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,13 @@ STATIC mp_uint_t get_arg_reglist(emit_inline_asm_t *emit, const char *op, mp_par
298298
return 0;
299299
}
300300

301-
STATIC int get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, int fit_mask) {
302-
if (!MP_PARSE_NODE_IS_SMALL_INT(pn)) {
301+
STATIC uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, uint32_t fit_mask) {
302+
mp_obj_t o;
303+
if (!mp_parse_node_get_int_maybe(pn, &o)) {
303304
emit_inline_thumb_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, "'%s' expects an integer", op));
304305
return 0;
305306
}
306-
int i = MP_PARSE_NODE_LEAF_SMALL_INT(pn);
307+
uint32_t i = mp_obj_get_int_truncated(o);
307308
if ((i & (~fit_mask)) != 0) {
308309
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));
309310
return 0;

0 commit comments

Comments
 (0)