diff options
author | Angus Gratton <angus@redyak.com.au> | 2025-05-02 15:39:35 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-07-18 00:12:13 +1000 |
commit | e9845ab20ec798c1d5bf00bd3b64ff5d96d94500 (patch) | |
tree | a3cb1999eac4270ca29d1f8556be8491595e5b62 /py/parsenum.c | |
parent | 516aa02104c3344903bdda078b7c87f71f94938d (diff) |
py/smallint: Update mp_small_int_mul_overflow() to perform the multiply.
Makes it compatible with the __builtin_mul_overflow() syntax, used in
follow-up commit.
Includes optimisation in runtime.c to minimise the code size impact from
additional param.
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'py/parsenum.c')
-rw-r--r-- | py/parsenum.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/parsenum.c b/py/parsenum.c index 7e6695fbf..31b332c18 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -99,10 +99,10 @@ mp_obj_t mp_parse_num_integer(const char *restrict str_, size_t len, int base, m } // add next digi and check for overflow - if (mp_small_int_mul_overflow(int_val, base)) { + if (mp_small_int_mul_overflow(int_val, base, &int_val)) { goto overflow; } - int_val = int_val * base + dig; + int_val += dig; if (!MP_SMALL_INT_FITS(int_val)) { goto overflow; } |