From d2276f0d41c2fa66a224725fdb2411846c91cf1a Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 25 Mar 2024 13:10:12 +1100 Subject: 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 --- py/dynruntime.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'py/dynruntime.h') diff --git a/py/dynruntime.h b/py/dynruntime.h index 7765fca40..d07b1dce2 100644 --- a/py/dynruntime.h +++ b/py/dynruntime.h @@ -29,6 +29,7 @@ // This header file contains definitions to dynamically implement the static // MicroPython runtime API defined in py/obj.h and py/runtime.h. +#include "py/binary.h" #include "py/nativeglue.h" #include "py/objfun.h" #include "py/objstr.h" @@ -184,6 +185,10 @@ static inline void *mp_obj_malloc_helper_dyn(size_t num_bytes, const mp_obj_type /******************************************************************************/ // General runtime functions +#define mp_binary_get_size(struct_type, val_type, palign) (mp_fun_table.binary_get_size((struct_type), (val_type), (palign))) +#define mp_binary_get_val_array(typecode, p, index) (mp_fun_table.binary_get_val_array((typecode), (p), (index))) +#define mp_binary_set_val_array(typecode, p, index, val_in) (mp_fun_table.binary_set_val_array((typecode), (p), (index), (val_in))) + #define mp_load_name(qst) (mp_fun_table.load_name((qst))) #define mp_load_global(qst) (mp_fun_table.load_global((qst))) #define mp_load_attr(base, attr) (mp_fun_table.load_attr((base), (attr))) -- cgit v1.2.3