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>
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user