summaryrefslogtreecommitdiff
path: root/py/parsenum.c
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2025-05-02 15:39:35 +1000
committerDamien George <damien@micropython.org>2025-07-18 00:12:13 +1000
commite9845ab20ec798c1d5bf00bd3b64ff5d96d94500 (patch)
treea3cb1999eac4270ca29d1f8556be8491595e5b62 /py/parsenum.c
parent516aa02104c3344903bdda078b7c87f71f94938d (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.c4
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;
}