| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
Using the original WORD_MSBIT_HIGH-logic resulted in errors when the
object model is not REPR_A or REPR_C.
|
|
|
|
| |
This function returns the sign (-1, 0 or 1) of the integer object.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
the operator argument. Hashing for int, str and bytes still go via
fast-path in mp_unary_op since they are the most common objects which
need to be hashed.
This lead to quite a bit of code cleanup, and should be more efficient
if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on
x86.
The only loss is that the error message "unhashable type" is now the
more generic "unsupported type for __hash__".
|
| |
|
|
|
|
|
|
|
| |
This gets int.to_bytes working for bignum, and also struct.pack with 'q'
and 'Q' args on 32-bit machines.
Addresses issue #1155.
|
| |
|
| |
|
|
|
|
| |
Addresses issue #1022.
|
|
|
|
|
|
|
| |
This fixes conversion when float type has more mantissa bits than small int,
and float value has small exponent. This is for example the case of 32-bit
platform using doubles, and converting value of time.time(). Conversion of
floats with larg exponnet is still not handled correctly.
|
|
|
|
|
|
|
|
|
|
|
| |
mp_obj_int_get_truncated is used as a "fast path" int accessor that
doesn't check for overflow and returns the int truncated to the machine
word size, ie mp_int_t.
Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word
sized values.
Addresses issues #779 and #998.
|
|
|
|
| |
Addresses issue #848.
|
|
|
|
|
|
| |
Type representing signed size doesn't have to be int, so use special value
which defaults to SSIZE_MAX, but as it's not defined by C standard (but rather
by POSIX), allow ports to set it.
|
|
|
|
| |
Addressing issue #50, still some way to go yet.
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Remove unnecessary includes. Add includes that improve portability.
|
|
|
|
|
| |
Some functionality is still missing (eg and, or, bit shift), and some
things are buggy (eg subtract).
|
| |
|
| |
|
|
|
|
|
| |
Done by introducing another factored out helper API in binary.c. This API
can be reused also by array and struct modules.
|
|
|
|
|
|
|
|
| |
Some tools do not support local/static symbols (one example is GNU ld map file).
Exposing all functions will allow to do detailed size comparisons, etc.
Also, added bunch of statics where they were missing, and replaced few identity
functions with global mp_identity().
|
|
|
|
|
| |
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
|
|
|
|
|
|
|
| |
__bool__() and __len__() are just the same as __neg__() or __invert__(),
and require efficient dispatching implementation (not requiring search/lookup).
type->unary_op() is just the right choice for this short of adding
standalone virtual method(s) to already big mp_obj_type_t structure.
|
| |
|
| |
|
|
|
|
|
| |
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
|