| Age | Commit message (Collapse) | Author |
|
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).
|
|
Addresses issue #765.
|
|
Implementing it as a static constant is a bit peculiar and require cooperation
from long int implementation.
|
|
See discussion in issue #50.
|
|
One thing is wanting to do 1 / 2 and get something else but 0, and quite
another - doing rocket science ;-).
|
|
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.
|
|
Also unifies use of SMALL_INT_FITS macro across parser and runtime.
|
|
Addresses issue #627.
|
|
See issue #608 for justification.
|
|
|
|
|
|
|
|
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/.
|
|
Specifically, nlr.h does.
|
|
Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL.
This helps a lot in debugging and understanding of function API.
|
|
I'm pretty sure these are never reached, since NOT_EQUAL is always
converted into EQUAL in mp_binary_op. No one should call
type.binary_op directly, they should always go through mp_binary_op
(or mp_obj_is_equal).
|
|
With the implementation of proper string formatting, code to print a
small int was delegated to mpz_as_str_inpl (after first converting the
small int to an mpz using stack memory). But mpz_as_str_inpl allocates
heap memory to do the conversion, so small ints needed heap memory just
to be printed.
This fix has a separate function to print small ints, which does not
allocate heap, and allocates less stack.
String formatting, printf and pfenv are now large beasts, with some
semi-duplicated code.
|
|
|
|
This does not affect code size or performance when debugging turned off.
To address issue #420.
|
|
|
|
Previous overflow test was inadequate.
|
|
|
|
|
|
Mostly just a global search and replace. Except rt_is_true which
becomes mp_obj_is_true.
Still would like to tidy up some of the names, but this will do for now.
|
|
|
|
|
|
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).
|
|
|
|
|
|
intdivmod.c and tests/basics/modulo.py.
|
|
|
|
|
|
Remove unnecessary includes. Add includes that improve portability.
|
|
If operation will overflow, a multi-precision integer is created.
|
|
|
|
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.
|
|
Some functionality is still missing (eg and, or, bit shift), and some
things are buggy (eg subtract).
|