diff options
author | Damien George <damien.p.george@gmail.com> | 2018-05-21 12:27:38 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-05-21 12:27:38 +1000 |
commit | 5efc575067df17be785d2b60124706d789d6cfe0 (patch) | |
tree | ce401726be92575a4382387ab2e9e1c223ca5f6d /py/parsenum.c | |
parent | bc6c0b28bf830a75c817fb498b713779c92b731b (diff) | |
download | micropython-5efc575067df17be785d2b60124706d789d6cfe0.tar.gz micropython-5efc575067df17be785d2b60124706d789d6cfe0.zip |
py/parsenum: Use int instead of mp_int_t for parsing float exponent.
There is no need to use the mp_int_t type which may be 64-bits wide, there
is enough bit-width in a normal int to parse reasonable exponents. Using
int helps to reduce code size for 64-bit ports, especially nan-boxing
builds. (Similarly for the "dig" variable which is now an unsigned int.)
Diffstat (limited to 'py/parsenum.c')
-rw-r--r-- | py/parsenum.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/parsenum.c b/py/parsenum.c index 124489c66e..8bd5232eb4 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -227,10 +227,10 @@ mp_obj_t mp_parse_num_decimal(const char *str, size_t len, bool allow_imag, bool // string should be a decimal number parse_dec_in_t in = PARSE_DEC_IN_INTG; bool exp_neg = false; - mp_int_t exp_val = 0; - mp_int_t exp_extra = 0; + int exp_val = 0; + int exp_extra = 0; while (str < top) { - mp_uint_t dig = *str++; + unsigned int dig = *str++; if ('0' <= dig && dig <= '9') { dig -= '0'; if (in == PARSE_DEC_IN_EXP) { |