summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-07-08 22:23:57 +1000
committerDamien George <damien.p.george@gmail.com>2018-07-08 22:27:05 +1000
commitd9cdb880ff9588c7e7f9c9374d2b333187cb990f (patch)
tree1c3cc0bc5affe76d011a52e9074f64ebc36292b3 /py/obj.h
parent3503f9626abbcbd59fe34009eef8f401c61f2b3d (diff)
py/objdict: Make mp_obj_dict_get_map an inline function.
It's a very simple function and saves code, and improves efficiency, by being inline. Note that this is an auxiliary helper function and so doesn't need mp_check_self -- that's used for functions that can be accessed directly from Python code (eg from a method table).
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index 0ff91e81f..3dacf9124 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -758,7 +758,9 @@ size_t mp_obj_dict_len(mp_obj_t self_in);
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index);
mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value);
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key);
-mp_map_t *mp_obj_dict_get_map(mp_obj_t self_in);
+static inline mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) {
+ return &((mp_obj_dict_t*)MP_OBJ_TO_PTR(dict))->map;
+}
// set
void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);