diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-06 17:15:34 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-06 17:15:34 +0100 |
commit | 9a21d2e070c9ee0ef2c003f3a668e635c6ae4401 (patch) | |
tree | 2eb42a2e11d8a7be9d1a2c328d7f2c37762ef2e6 /tests/basics/int_big_div.py | |
parent | afb1cf75dde70638d26fd33e6246f8f52b22471b (diff) | |
download | micropython-9a21d2e070c9ee0ef2c003f3a668e635c6ae4401.tar.gz micropython-9a21d2e070c9ee0ef2c003f3a668e635c6ae4401.zip |
py: Make mpz able to use 16 bits per digit; and 32 on 64-bit arch.
Previously, mpz was restricted to using at most 15 bits in each digit,
where a digit was a uint16_t.
With this patch, mpz can use all 16 bits in the uint16_t (improvement
to mpn_div was required). This gives small inprovements in speed and
RAM usage. It also yields savings in ROM code size because all of the
digit masking operations become no-ops.
Also, mpz can now use a uint32_t as the digit type, and hence use 32
bits per digit. This will give decent improvements in mpz speed on
64-bit machines.
Test for big integer division added.
Diffstat (limited to 'tests/basics/int_big_div.py')
-rw-r--r-- | tests/basics/int_big_div.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/basics/int_big_div.py b/tests/basics/int_big_div.py new file mode 100644 index 0000000000..8dacf495db --- /dev/null +++ b/tests/basics/int_big_div.py @@ -0,0 +1,3 @@ +for lhs in (1000000000000000000000000, 10000000000100000000000000, 10012003400000000000000007, 12349083434598210349871029923874109871234789): + for rhs in range(1, 555): + print(lhs // rhs) |