Paul Sokolovsky
af90461931
py/binary: mp_binary_get_size: Raise error on unsupported typecodes.
...
Previouly, we had errors checked in callers, which led to duplicate code
or missing checks in some places.
2017-01-17 22:53:06 +03:00
Damien George
a3c61004c2
py/binary: Do zero extension when storing a value larger than word size.
2016-12-12 15:00:06 +11:00
Damien George
999cedb90f
py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.
...
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-29 14:25:35 +00:00
Damien George
88a9103b3c
py/binary: Make use of MP_ALIGN.
2015-11-27 12:05:11 +00:00
Paul Sokolovsky
91fc075a33
py/objarray: Allow to create array of void pointers, as extension to CPython.
...
Using 'P' format specifier (matches struct module). This is another shortcut
for FFI, just as previously introduced "array of objects" ('O').
2015-10-12 10:13:51 +03:00
Damien George
81794fcd31
py/binary: Add support for array('q') and array('Q').
2015-09-01 16:31:48 +01:00
Kaspar Schleiser
f5dd6f7f37
py/binary: Make return type of mp_binary_get_size size_t instead of int.
...
Fixes sign-compare warning.
2015-05-17 18:12:19 +01:00
Damien George
9472907ae1
py: Fix handling of negative numbers in struct.pack of q/Q.
2015-04-25 23:51:14 +01:00
Damien George
271d18eb08
py: Support conversion of bignum to bytes.
...
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-04-25 23:16:39 +01:00
Paul Sokolovsky
24c1000741
objarray: Support array('O'), array of objects, as extension to CPython.
...
Might be useful at least for memoryview hacks.
2015-03-05 22:58:31 +02:00
David Steinberg
0b3014ce3a
py: Add support for floats in mp_binary_{get,set}_val()
...
- This then provides support for floats in the struct package
2015-01-27 22:49:01 +02:00
Paul Sokolovsky
91232d3850
binary: Rework array accessors. They work with native, not stdint types.
2015-01-24 03:18:33 +02:00
Damien George
963a5a3e82
py, unix: Allow to compile with -Wsign-compare.
...
See issue #699 .
2015-01-16 17:47:07 +00:00
Damien George
51dfcb4bb7
py: Move to guarded includes, everywhere in py/ core.
...
Addresses issue #1022 .
2015-01-01 20:32:09 +00:00
Damien George
be6d8be91e
py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.
...
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-12-05 23:13:52 +00:00
Damien George
c9f8f653ad
py: Add support for float/double arrays in array module.
...
Addresses issue #981 .
2014-11-21 18:16:25 +00:00
Damien George
9336ee320a
py: Make mp_binary_set_val work on big endian machine.
2014-10-06 15:05:35 +00:00
Damien George
42f3de924b
py: Convert [u]int to mp_[u]int_t where appropriate.
...
Addressing issue #50 .
2014-10-03 17:44:14 +00:00
Damien George
953074315e
py: Enable struct/binary-helper to parse q and Q sized ints.
...
Addresses issue #848 .
2014-09-10 22:10:33 +01:00
Paul Sokolovsky
78fde4819c
modstruct: Implement 'O', 'P', 's' types for packed structs.
...
This is required to deal with, well, packed C structs containing pointers.
2014-09-06 20:22:06 +03:00
Damien George
4abff7500f
py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.
...
Part of code cleanup, working towards resolving issue #50 .
2014-08-30 14:59:21 +01:00
Paul Sokolovsky
ecca53bd34
py: binary.c: Properly implement alignment for native unpacked structs.
2014-08-10 23:21:08 +03:00
Paul Sokolovsky
5fa5ca40e6
binary: Factor out mp_binary_set_int().
2014-07-05 23:54:03 +03:00
Damien George
40f3c02682
Rename machine_(u)int_t to mp_(u)int_t.
...
See discussion in issue #50 .
2014-07-03 13:25:24 +01:00
Paul Sokolovsky
f3de62e6c2
binary: machine_uint_t vs uint dichotomy starts doing real damage.
2014-06-26 00:41:08 +03:00