mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
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.
This commit is contained in:
@@ -77,13 +77,13 @@ typedef struct _machine_mem_obj_t {
|
||||
|
||||
STATIC void machine_mem_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
(void)kind;
|
||||
machine_mem_obj_t *self = self_in;
|
||||
machine_mem_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_printf(print, "<%u-bit memory>", 8 * self->elem_size);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t machine_mem_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
|
||||
// TODO support slice index to read/write multiple values at once
|
||||
machine_mem_obj_t *self = self_in;
|
||||
machine_mem_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (value == MP_OBJ_NULL) {
|
||||
// delete
|
||||
return MP_OBJ_NULL; // op not supported
|
||||
|
||||
Reference in New Issue
Block a user