summaryrefslogtreecommitdiffstatshomepage
path: root/py/objint_longlong.c
Commit message (Collapse)AuthorAge
* py: Use MP_SMALL_INT_POSITIVE_MASK to check if uint fits in a small int.Damien George2016-03-10
| | | | | Using the original WORD_MSBIT_HIGH-logic resulted in errors when the object model is not REPR_A or REPR_C.
* py: Change mp_obj_int_is_positive to more general mp_obj_int_sign.Damien George2016-01-07
| | | | This function returns the sign (-1, 0 or 1) of the integer object.
* py/objint_longlong: Instead of assert, throw OverflowError.Paul Sokolovsky2015-11-09
|
* py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.Paul Sokolovsky2015-10-11
|
* py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.Damien George2015-05-12
| | | | | | | | | | | | | | 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__".
* py: Implement power op for long-long implementation of bignum.Damien George2015-04-25
|
* py: Support conversion of bignum to bytes.Damien George2015-04-25
| | | | | | | This gets int.to_bytes working for bignum, and also struct.pack with 'q' and 'Q' args on 32-bit machines. Addresses issue #1155.
* py: Fix builtin abs so it works for bools and bignum.Damien George2015-03-14
|
* py: Use float-to-int classifications for mp_obj_new_int_from_float() functionsDavid Steinberg2015-01-24
|
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Partially fix float to int conversion.Paul Sokolovsky2014-12-30
| | | | | | | 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.
* py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George2014-12-05
| | | | | | | | | | | 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.
* py: Enable struct/binary-helper to parse q and Q sized ints.Damien George2014-09-10
| | | | Addresses issue #848.
* py: Correctly set sys.maxsize value for 64-bit.Paul Sokolovsky2014-09-06
| | | | | | 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.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* py: Make long ints hashable.Damien George2014-07-24
| | | | Addresses issue #765.
* py: Implement sys.maxsize, standard way to check platform "bitness".Paul Sokolovsky2014-07-03
| | | | | Implementing it as a static constant is a bit peculiar and require cooperation from long int implementation.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* 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: Fix check of small-int overflow when parsing ints.Damien George2014-05-28
| | | | Also unifies use of SMALL_INT_FITS macro across parser and runtime.
* py: Implement long int parsing in int(...).Damien George2014-05-28
| | | | Addresses issue #627.
* py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George2014-05-21
| | | | See issue #608 for justification.
* py: More const usage.Paul Sokolovsky2014-05-17
|
* py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky2014-05-13
|
* py: Improve native emitter; now supports more opcodes.Damien George2014-05-07
|
* 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, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* py: Add MP_OBJ_STOP_ITERATION and make good use of it.Damien George2014-04-17
| | | | | Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL. This helps a lot in debugging and understanding of function API.
* py: Remove useless implementations of NOT_EQUAL in binary_op's.Damien George2014-04-12
| | | | | | | 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).
* py: Make it so that printing a small int does not allocate heap memory.Damien George2014-04-08
| | | | | | | | | | | | | | 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.
* Add string formatting support for longlong and mpz.Dave Hylands2014-04-07
|
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* py: Make False and True act like 0 and 1 for integer arithmetic.Damien George2014-04-04
|
* py: Allow multiple of str/list/tuple on left by an integer.Damien George2014-04-02
|
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | 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.
* py: Rename old const type objects to mp_type_* for consistency.Damien George2014-03-29
|
* py: Add function to convert long int to float.Damien George2014-03-22
|
* py: Fix int-longlong binary operations.Damien George2014-03-20
|
* py: Add comment about bugs in objint_longlong.c.Damien George2014-03-19
|
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* 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).
* py: Fix casting and printing of small int.Damien George2014-02-22
|
* objint_longlong: Don't assert on invalid syntax, raise SyntaxError instead.Paul Sokolovsky2014-02-18
|
* ffi: Implement ffivar.get()/set() methods.Paul Sokolovsky2014-02-14
| | | | | Done by introducing another factored out helper API in binary.c. This API can be reused also by array and struct modules.
* Replace global "static" -> "STATIC", to allow "analysis builds". Part 1.Paul Sokolovsky2014-02-12
| | | | | | | | 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().
* py: Tidy up BINARY_OPs; negation done by special NOT bytecode.Damien George2014-02-01
| | | | | IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
* Implement __bool__ and __len__ via unary_op virtual method for all types.Paul Sokolovsky2014-01-30
| | | | | | | __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.
* long int: Implement more operations.Paul Sokolovsky2014-01-27
|
* Second stage of qstr revamp: uPy str object can be qstr or not.Damien George2014-01-22
|
* Revamp qstrs: they now include length and hash.Damien George2014-01-21
| | | | | Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h