summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--py/obj.h17
-rw-r--r--py/objcell.c15
2 files changed, 15 insertions, 17 deletions
diff --git a/py/obj.h b/py/obj.h
index 29cd1855c..84ca94213 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -838,8 +838,21 @@ mp_obj_t mp_obj_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t val);
mp_obj_t mp_generic_unary_op(mp_unary_op_t op, mp_obj_t o_in);
// cell
-mp_obj_t mp_obj_cell_get(mp_obj_t self_in);
-void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj);
+
+typedef struct _mp_obj_cell_t {
+ mp_obj_base_t base;
+ mp_obj_t obj;
+} mp_obj_cell_t;
+
+static inline mp_obj_t mp_obj_cell_get(mp_obj_t self_in) {
+ mp_obj_cell_t *self = (mp_obj_cell_t *)MP_OBJ_TO_PTR(self_in);
+ return self->obj;
+}
+
+static inline void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) {
+ mp_obj_cell_t *self = (mp_obj_cell_t *)MP_OBJ_TO_PTR(self_in);
+ self->obj = obj;
+}
// int
// For long int, returns value truncated to mp_int_t
diff --git a/py/objcell.c b/py/objcell.c
index 2702ca535..cab0d0b03 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -26,21 +26,6 @@
#include "py/obj.h"
-typedef struct _mp_obj_cell_t {
- mp_obj_base_t base;
- mp_obj_t obj;
-} mp_obj_cell_t;
-
-mp_obj_t mp_obj_cell_get(mp_obj_t self_in) {
- mp_obj_cell_t *self = MP_OBJ_TO_PTR(self_in);
- return self->obj;
-}
-
-void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) {
- mp_obj_cell_t *self = MP_OBJ_TO_PTR(self_in);
- self->obj = obj;
-}
-
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
STATIC void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;