summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpz.c
Commit message (Collapse)AuthorAge
* mpz: Fix 64bit msvc buildstijn2014-10-30
| | | | | | msvc does not treat 1L a 64bit integer hence all occurences of shifting it left or right result in undefined behaviour since the maximum allowed shift count for 32bit ints is 31. Forcing the correct type explicitely, stored in MPZ_LONG_1, solves this.
* py: Convert [u]int to mp_[u]int_t where appropriate.Damien George2014-10-03
| | | | Addressing issue #50.
* py: Enable struct/binary-helper to parse q and Q sized ints.Damien George2014-09-10
| | | | Addresses issue #848.
* py: Make mpz able to use 16 bits per digit; and 32 on 64-bit arch.Damien George2014-09-06
| | | | | | | | | | | | | | | | 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.
* py: Convert (u)int to mp_(u)int_t in mpz, and remove unused function.Damien George2014-09-05
|
* py: Save about 200 bytes of ROM by using smaller type for static table.Damien George2014-08-30
|
* py: Fix bug in mpn_shl (multi-prec int shift left).Damien George2014-08-07
| | | | | Before this patch, eg, 1 << 75 (or any large multiple of 15) was setting the MSB in the digits, which is outside the valid range of DIG_MASK.
* py: Improve handling of long-int overflow.Damien George2014-07-31
| | | | | | | | | | This removes mpz_as_int, since that was a terrible function (it implemented saturating conversion). Use mpz_as_int_checked and mpz_as_uint_checked. These now work correctly (they previously had wrong overflow checking, eg print(chr(10000000000000)) on 32-bit machine would incorrectly convert this large number to a small int).
* py: Make long ints hashable.Damien George2014-07-24
| | | | Addresses issue #765.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Include mpconfig.h before all other includes.Paul Sokolovsky2014-06-21
| | | | | | It defines types used by all other headers. Fixes #691.
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* py: Implement bignum '&' with negatives on lhs and rhs.Damien George2014-05-29
| | | | | Needs proper coverage testing. Doesn't implement -ve & -ve. Addresses issue #611.
* py: Improve mpz_and function.Damien George2014-05-13
| | | | This should now have correct (and optimal) behaviour.
* py: Fix bug in mpz_and function.Damien George2014-05-12
| | | | Addresses issue #610.
* Windows MSVC portstijn2014-05-08
| | | | Extend the windows port so it compiles with the toolchain from Visual Studio 2013
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* py: Add comment mpz function, and free memory used for string printing.Damien George2014-04-08
|
* Add string formatting support for longlong and mpz.Dave Hylands2014-04-07
|
* py: Handle small int power overflow correctly.Damien George2014-04-04
|
* py: More robust int conversion and overflow checking.Damien George2014-04-03
|
* objint_mpz: Quick&dirty implementation of bitwise operations.Paul Sokolovsky2014-03-23
| | | | | | | Made solely to unbreak int-long.py test which in turn uncovered thinko with implementation of inplace ops. On mpz level, bitwise ops implemented only for same-sign numbers, and are not efficient (unconditional calling of mpn_cmp() is apparently superfluous).
* py: Fix some bugs in mpz; add mpz_from_ll and mpz_set_from_ll.Damien George2014-03-12
| | | | A couple of bugs in mpn_shl, and overflow bug in mpz_set_from_int.
* py: Wrap mpz float functions in MICROPY_ENABLE_FLOAT.Damien George2014-03-08
|
* py: Implement bit-shift and not operations for mpz.Damien George2014-03-01
| | | | | | Implement not, shl and shr in mpz library. Add function to create mpzs on the stack, used for memory efficiency when rhs is a small int. Factor out code to parse base-prefix of number into a dedicated function.
* py: Start to implement shl/shr for mpz. Fix return void.Damien George2014-02-26
|
* py: Fix mpn_sub, was increasing wrong source pointer.Damien George2014-02-24
| | | | Also change int -> machine_int_t where appropriate.
* Add arbitrary precision integer support.Damien George2014-02-22
Some functionality is still missing (eg and, or, bit shift), and some things are buggy (eg subtract).