summaryrefslogtreecommitdiff
path: root/py/objcode.c
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2025-07-15 11:23:28 +1000
committerDamien George <damien@micropython.org>2025-07-18 00:12:16 +1000
commit17fbc5abdc7e139a922f6a11619deb7cb031e0cb (patch)
treea280d07a0c2e781e9605a863c33a723d941b08b9 /py/objcode.c
parente9845ab20ec798c1d5bf00bd3b64ff5d96d94500 (diff)
py/parsenum: Extend mp_parse_num_integer() to parse long long.
If big integer support is 'long long' then mp_parse_num_integer() can parse to it directly instead of failing over from small int. This means strtoll() is no longer pulled in, and fixes some bugs parsing long long integers (i.e. can now parse negative values correctly, can now parse values which aren't NULL terminated). The (default) smallint parsing compiled code should stay the same here, macros and a typedef are used to abstract some parts of it out. When bigint is long long we parse to 'unsigned long long' first (to avoid the code size hit of pulling in signed 64-bit math routines) and the convert to signed at the end. One tricky case this routine correctly overflows on is int("9223372036854775808") which is one more than LLONG_MAX in decimal. No unit test case added for this as it's too hard to detect 64-bit long integer mode. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'py/objcode.c')
0 files changed, 0 insertions, 0 deletions