summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-09-23 23:17:56 +1000
committerDamien George <damien@micropython.org>2020-09-25 12:23:11 +1000
commit50e34f979c90584273a67ecd9189640417a60960 (patch)
treea1deaac706d879cb6d73b0672e22af2e46d2fded
parentca017841d65b5f9da5eb4e6e3ca66b009bc54fc4 (diff)
downloadmicropython-50e34f979c90584273a67ecd9189640417a60960.tar.gz
micropython-50e34f979c90584273a67ecd9189640417a60960.zip
py/objarray.h: Add mp_obj_memoryview_init() helper function.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--py/objarray.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/py/objarray.h b/py/objarray.h
index 2fb6e2c915..94c31c9693 100644
--- a/py/objarray.h
+++ b/py/objarray.h
@@ -49,4 +49,14 @@ typedef struct _mp_obj_array_t {
void *items;
} mp_obj_array_t;
+#if MICROPY_PY_BUILTINS_MEMORYVIEW
+static inline void mp_obj_memoryview_init(mp_obj_array_t *self, size_t typecode, size_t offset, size_t len, void *items) {
+ self->base.type = &mp_type_memoryview;
+ self->typecode = typecode;
+ self->free = offset;
+ self->len = len;
+ self->items = items;
+}
+#endif
+
#endif // MICROPY_INCLUDED_PY_OBJARRAY_H