- May 06, 2019
-
-
Jun Wu authored
Prior to this commit, building the unix port with `DEBUG=1` and `-finstrument-functions` the compilation would fail with an error like "control reaches end of non-void function". This change fixes this by removing the problematic "if (0)" branches. Not all branches affect compilation, but they are all removed for consistency.
-
- Feb 12, 2019
-
-
Damien George authored
These macros could in principle be (inline) functions so it makes sense to have them lower case, to match the other C API functions. The remaining macros that are upper case are: - MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR - MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE - MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE - MP_OBJ_FUN_MAKE_SIG - MP_DECLARE_CONST_xxx - MP_DEFINE_CONST_xxx These must remain macros because they are used when defining const data (at least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have MP_OBJ_SMALL_INT_VALUE also a macro). For those macros that have been made lower case, compatibility macros are provided for the old names so that users do not need to change their code immediately.
-
- Sep 20, 2018
-
-
Damien George authored
-
- Apr 04, 2018
-
-
Damien George authored
The LHS passed to mp_obj_int_binary_op() will always be an integer, either a small int or a big int, so the test for this type doesn't need to include an "other, unsupported type" case.
-
- Nov 24, 2017
-
-
Damien George authored
Before this patch MP_BINARY_OP_IN had two meanings: coming from bytecode it meant that the args needed to be swapped, but coming from within the runtime meant that the args were already in the correct order. This lead to some confusion in the code and comments stating how args were reversed. It also lead to 2 bugs: 1) containment for a subclass of a native type didn't work; 2) the expression "{True} in True" would illegally succeed and return True. In both of these cases it was because the args to MP_BINARY_OP_IN ended up being reversed twice. To fix these things this patch introduces MP_BINARY_OP_CONTAINS which corresponds exactly to the __contains__ special method, and this is the operator that built-in types should implement. MP_BINARY_OP_IN is now only emitted by the compiler and is converted to MP_BINARY_OP_CONTAINS by swapping the arguments.
-
- Oct 04, 2017
-
-
Damien George authored
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
-
- Sep 17, 2017
-
-
Paul Sokolovsky authored
This allows user classes to implement __abs__ special method, and saves code size (104 bytes for x86_64), even though during refactor, an issue was fixed and few optimizations were made: * abs() of minimum (negative) small int value is calculated properly. * objint_longlong and objint_mpz avoid allocating new object is the argument is already non-negative.
-
- Sep 07, 2017
-
-
Paul Sokolovsky authored
This is to allow to place reverse ops immediately after normal ops, so they can be tested as one range (which is optimization for reverse ops introduction in the next patch).
-
Paul Sokolovsky authored
This is to allow to encode arithmetic operations more efficiently, in preparation to introduction of __rOP__ method support.
-
- Aug 29, 2017
-
-
Damien George authored
The unary-op/binary-op enums are already defined, and there are no arithmetic tricks used with these types, so it makes sense to use the correct enum type for arguments that take these values. It also reduces code size quite a bit for nan-boxing builds.
-
- Jul 31, 2017
-
-
Alexander Steffen authored
There were several different spellings of MicroPython present in comments, when there should be only one.
-
- Jul 25, 2017
-
-
Damien George authored
Before this patch raising a big-int to a negative power would just return 0. Now it returns a floating-point number with the correct value.
-
- Apr 21, 2017
-
-
Paul Sokolovsky authored
-
- Apr 04, 2017
-
-
Damien George authored
This reduces code duplication and allows to make mp_classify_fp_as_int static, which reduces code size.
-
- Mar 28, 2017
-
-
Damien George authored
Saves 168 bytes on bare-arm.
-
- Feb 16, 2017
-
-
Damien George authored
-
- Feb 02, 2017
-
-
Nicko van Someren authored
Updated modbuiltin.c to add conditional support for 3-arg calls to pow() using MICROPY_PY_BUILTINS_POW3 config parameter. Added support in objint_mpz.c for for optimised implementation.
-
- Jan 21, 2017
-
-
Paul Sokolovsky authored
If result guaranteedly fits in a small int, it is handled in objint.c. Otherwise, it is delegated to mp_obj_int_from_bytes_impl(), which should be implemented by individual objint_*.c, similar to mp_obj_int_to_bytes_impl().
-
- Jan 19, 2017
-
-
Damien George authored
-
- Dec 21, 2016
-
-
Damien George authored
And also simplify it to remove the check for small int. This can be done because this function is only ever called if the argument is not a small int.
-
- Oct 17, 2016
-
-
Damien George authored
Saves the following number of bytes of code space: 176 for bare-arm, 352 for minimal, 272 for unix x86-64, 140 for stmhal, 120 for esp8266.
-
- Oct 11, 2016
-
-
Damien George authored
-
Damien George authored
-
- May 08, 2016
-
-
Damien George authored
This patch consolidates the Python logic for division/modulo to one place within the bignum code.
-
- Mar 10, 2016
-
-
Damien George authored
Using the original WORD_MSBIT_HIGH-logic resulted in errors when the object model is not REPR_A or REPR_C.
-
- Jan 07, 2016
-
-
Damien George authored
This function returns the sign (-1, 0 or 1) of the integer object.
-
- Nov 29, 2015
-
-
Damien George authored
This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
-
- Oct 20, 2015
-
-
Damien George authored
-
- Oct 11, 2015
-
-
Paul Sokolovsky authored
-
- Oct 01, 2015
-
-
Damien George authored
-
- Sep 15, 2015
-
-
Damien George authored
When creating constant mpz's, the length of the mpz must be exactly how many digits are used (not allocated) otherwise these numbers are not compatible with dynamically allocated numbers. Addresses issue #1448.
-
- Jun 13, 2015
-
-
Damien George authored
-
- May 12, 2015
-
-
Damien George authored
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__".
-
- Apr 25, 2015
-
-
Damien George authored
This gets int.to_bytes working for bignum, and also struct.pack with 'q' and 'Q' args on 32-bit machines. Addresses issue #1155.
-
- Apr 22, 2015
-
-
Damien George authored
-
- Mar 14, 2015
-
-
Damien George authored
-
- Jan 24, 2015
-
-
David Steinberg authored
-
- Jan 07, 2015
-
-
Damien George authored
Addresses issue #1044 (see also #1040). Could do with a better fix.
-
- Jan 02, 2015
-
-
Damien George authored
-
David Steinberg authored
-