summaryrefslogtreecommitdiff
path: root/py/binary.c
AgeCommit message (Collapse)Author
2017-08-15py/binary.c: Fix bug when packing big-endian 'Q' values.Bas van Sisseren
Without bugfix: struct.pack('>Q', 16) b'\x00\x00\x00\x10\x00\x00\x00\x00' With bugfix: struct.pack('>Q', 16) b'\x00\x00\x00\x00\x00\x00\x00\x10'
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-04py/binary: Add missing "break" statements.Damien George
2017-05-09py/binary: Handle storing big-ints to all arrays types.Damien George
Prior to this patch only 'q' and 'Q' type arrays could store big-int values. With this patch any big int that is stored to an array is handled by the big-int implementation, regardless of the typecode of the array. This allows arrays to work with all type sizes on all architectures.
2017-01-17py/binary: mp_binary_get_size: Raise error on unsupported typecodes.Paul Sokolovsky
Previouly, we had errors checked in callers, which led to duplicate code or missing checks in some places.
2016-12-12py/binary: Do zero extension when storing a value larger than word size.Damien George
2015-11-29py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George
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.
2015-11-27py/binary: Make use of MP_ALIGN.Damien George
2015-10-12py/objarray: Allow to create array of void pointers, as extension to CPython.Paul Sokolovsky
Using 'P' format specifier (matches struct module). This is another shortcut for FFI, just as previously introduced "array of objects" ('O').
2015-09-01py/binary: Add support for array('q') and array('Q').Damien George
2015-05-17py/binary: Make return type of mp_binary_get_size size_t instead of int.Kaspar Schleiser
Fixes sign-compare warning.
2015-04-25py: Fix handling of negative numbers in struct.pack of q/Q.Damien George
2015-04-25py: Support conversion of bignum to bytes.Damien George
This gets int.to_bytes working for bignum, and also struct.pack with 'q' and 'Q' args on 32-bit machines. Addresses issue #1155.
2015-03-05objarray: Support array('O'), array of objects, as extension to CPython.Paul Sokolovsky
Might be useful at least for memoryview hacks.
2015-01-27py: Add support for floats in mp_binary_{get,set}_val()David Steinberg
- This then provides support for floats in the struct package
2015-01-24binary: Rework array accessors. They work with native, not stdint types.Paul Sokolovsky
2015-01-16py, unix: Allow to compile with -Wsign-compare.Damien George
See issue #699.
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-05py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George
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.
2014-11-21py: Add support for float/double arrays in array module.Damien George
Addresses issue #981.
2014-10-06py: Make mp_binary_set_val work on big endian machine.Damien George
2014-10-03py: Convert [u]int to mp_[u]int_t where appropriate.Damien George
Addressing issue #50.
2014-09-10py: Enable struct/binary-helper to parse q and Q sized ints.Damien George
Addresses issue #848.
2014-09-06modstruct: Implement 'O', 'P', 's' types for packed structs.Paul Sokolovsky
This is required to deal with, well, packed C structs containing pointers.
2014-08-30py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-10py: binary.c: Properly implement alignment for native unpacked structs.Paul Sokolovsky
2014-07-05binary: Factor out mp_binary_set_int().Paul Sokolovsky
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-06-26binary: machine_uint_t vs uint dichotomy starts doing real damage.Paul Sokolovsky
2014-06-25modstruct: Fix alignment handling issues.Paul Sokolovsky
Also, factor out mp_binary_get_int() function.
2014-06-21py: Include mpconfig.h before all other includes.Paul Sokolovsky
It defines types used by all other headers. Fixes #691.
2014-06-02modstruct: Add one more extension to typecodes - 'S', a pointer to C string.Paul Sokolovsky
Also, add comment with description of extension to CPython's typecodes.
2014-06-01Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George
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.
2014-05-03Add license header to (almost) all files.Damien George
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/.
2014-04-20modstruct: Add 'O' typecode for passing mp_obj_t.Paul Sokolovsky
Useful as callback data, etc.
2014-04-20modstruct: Use proper int accessor which checks input value type.Paul Sokolovsky
2014-04-19modstruct: Initial implementation of struct.pack().Paul Sokolovsky
2014-04-19modstruct: Fix .calcsize() to account for struct type/alignment.Paul Sokolovsky
2014-04-19modstruct: Support 'q' & 'Q' type codes.Paul Sokolovsky
2014-04-18py: Add mp_binary_set_val_array_from_int, to store an int directly.Damien George
2014-04-11modstruct: Basic implementation of native struct alignment and types.Paul Sokolovsky
2014-04-11binary: Rename array accessors for clarity.Paul Sokolovsky
2014-04-11modstruct: Refactor to support both LE and BE packed structs.Paul Sokolovsky
2014-04-10py: Start implementing "struct" module.Paul Sokolovsky
Only calcsize() and unpack() functions provided so far, for little-endian byte order. Format strings don't support repition spec (like "2b3i"). Unfortunately, dealing with all the various binary type sizes and alignments will lead to quite a bloated "binary" helper functions - if optimizing for speed. Need to think if using dynamic parametrized algos makes more sense.
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-02-22Add arbitrary precision integer support.Damien George
Some functionality is still missing (eg and, or, bit shift), and some things are buggy (eg subtract).
2014-02-15py: Revent some long int configuration.Damien George
2014-02-15Small change to configuration of long int.Damien George
2014-02-15mp_binary_get_val(): Fix value type.Paul Sokolovsky
2014-02-14objarray: Refactor to use array accessors from binary.c .Paul Sokolovsky