diff options
author | Emil Renner Berthing <esmil@mailme.dk> | 2020-10-03 10:51:59 +0200 |
---|---|---|
committer | Emil Renner Berthing <esmil@mailme.dk> | 2020-10-22 11:47:36 +0200 |
commit | fdd6fa389ed68a5d0761f7cb71c94db5e927d741 (patch) | |
tree | f918a2e7c37a9e69a730d2cd1f612924858a4d28 /py/emitinlinextensa.c | |
parent | 6d3aa16443c3eeef3945bf3d31429a655f690e0c (diff) |
py: Use unsigned comparison of chars.
On x86 chars are signed, but we're comparing a char to '0' + unsigned int,
which is promoted to an unsigned int. Let's promote the char to unsigned
before doing the comparison to avoid weird corner cases.
Diffstat (limited to 'py/emitinlinextensa.c')
-rw-r--r-- | py/emitinlinextensa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/emitinlinextensa.c b/py/emitinlinextensa.c index 6cc2e4d34..5dac2ae39 100644 --- a/py/emitinlinextensa.c +++ b/py/emitinlinextensa.c @@ -92,7 +92,7 @@ STATIC mp_uint_t emit_inline_xtensa_count_params(emit_inline_asm_t *emit, mp_uin return 0; } const char *p = qstr_str(MP_PARSE_NODE_LEAF_ARG(pn_params[i])); - if (!(strlen(p) == 2 && p[0] == 'a' && p[1] == '2' + i)) { + if (!(strlen(p) == 2 && p[0] == 'a' && (mp_uint_t)p[1] == '2' + i)) { emit_inline_xtensa_error_msg(emit, MP_ERROR_TEXT("parameters must be registers in sequence a2 to a5")); return 0; } |