diff options
author | Damien George <damien@micropython.org> | 2024-03-25 13:10:12 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-03-28 16:18:09 +1100 |
commit | d2276f0d41c2fa66a224725fdb2411846c91cf1a (patch) | |
tree | e3f25bf47b4e8adfd5fd341819fded5457d961e4 /py/nativeglue.h | |
parent | 4662a71f44bd8a0f8ff96d12e43f69be3bff8488 (diff) |
py/dynruntime: Add mp_binary_get_size/get_val_array/set_val_array.
These are needed to read/write array.array objects, which is useful in
native code to provide fast extensions that work with big arrays of data.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/nativeglue.h')
-rw-r--r-- | py/nativeglue.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/py/nativeglue.h b/py/nativeglue.h index 113f5fde6..1fa859334 100644 --- a/py/nativeglue.h +++ b/py/nativeglue.h @@ -156,7 +156,12 @@ typedef struct _mp_fun_table_t { double (*obj_get_float_to_d)(mp_obj_t o); bool (*get_buffer)(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags); const mp_stream_p_t *(*get_stream_raise)(mp_obj_t self_in, int flags); + size_t (*binary_get_size)(char struct_type, char val_type, size_t *palign); + mp_obj_t (*binary_get_val_array)(char typecode, void *p, size_t index); + void (*binary_set_val_array)(char typecode, void *p, size_t index, mp_obj_t val_in); const mp_print_t *plat_print; + // The following entries start at index 70 and are referenced by tools-mpy_ld.py, + // see constant MP_FUN_TABLE_MP_TYPE_TYPE_OFFSET. const mp_obj_type_t *type_type; const mp_obj_type_t *type_str; const mp_obj_type_t *type_list; |