diff --git a/py/map.c b/py/map.c index d40e3dc4d02d7..e3195f56878cf 100644 --- a/py/map.c +++ b/py/map.c @@ -153,6 +153,8 @@ static void mp_map_rehash(mp_map_t *map) { // - returns slot, with key non-null and value=MP_OBJ_NULL if it was added // MP_MAP_LOOKUP_REMOVE_IF_FOUND behaviour: // - returns NULL if not found, else the slot if was found in with key null and value non-null +mp_map_elem_t *mp_map_lookup_sub(mp_map_t * map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind, bool compare_only_ptrs); + mp_map_elem_t *MICROPY_WRAP_MP_MAP_LOOKUP(mp_map_lookup)(mp_map_t * map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind) { // If the map is a fixed array then we must only be called for a lookup assert(!map->is_fixed || lookup_kind == MP_MAP_LOOKUP); @@ -188,6 +190,10 @@ mp_map_elem_t *MICROPY_WRAP_MP_MAP_LOOKUP(mp_map_lookup)(mp_map_t * map, mp_obj_ } } + return mp_map_lookup_sub(map, index, lookup_kind, compare_only_ptrs); +} + +mp_map_elem_t *mp_map_lookup_sub(mp_map_t * map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind, bool compare_only_ptrs) { // if the map is an ordered array then we must do a brute force linear search if (map->is_ordered) { for (mp_map_elem_t *elem = &map->table[0], *top = &map->table[map->used]; elem < top; elem++) {