diff options
author | Damien George <damien@micropython.org> | 2021-11-30 00:31:46 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-12-21 18:00:05 +1100 |
commit | 2c139bbf4e5724ab253b5b034ce925e04267a9c4 (patch) | |
tree | 68837dc2bebd0350d59b7ab50fbf0c4cab275676 /tests/basics/sys_path.py | |
parent | 05bea70979232629e059a7453fb7965545113d9f (diff) | |
download | micropython-2c139bbf4e5724ab253b5b034ce925e04267a9c4.tar.gz micropython-2c139bbf4e5724ab253b5b034ce925e04267a9c4.zip |
py/mpz: Fix bugs with bitwise of -0 by ensuring all 0's are positive.
This commit makes sure that the value zero is always encoded in an mpz_t as
neg=0 and len=0 (previously it was just len=0).
This invariant is needed for some of the bitwise operations that operate on
negative numbers, because they cannot handle -0. For example
(-((1<<100)-(1<<100)))|1 was being computed as -65535, instead of 1.
Fixes issue #8042.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/basics/sys_path.py')
0 files changed, 0 insertions, 0 deletions