aboutsummaryrefslogtreecommitdiff
path: root/py/map.h
diff options
context:
space:
mode:
authorDamien George2014-02-08 18:47:46 +0000
committerDamien George2014-02-08 18:47:46 +0000
commit9a58d760c3594aa5c75ad4b6be8b70f719e8a867 (patch)
tree3ed30d4e7db5151498adb30c6b2aac4e240d31e9 /py/map.h
parent698ec21e46564ff0c2c71bf11d7eb4ef349c88d9 (diff)
py: Allow mp_map_t to be initialised by a fixed-size, const table.
This allows keyword maps to be created directly from stack data.
Diffstat (limited to 'py/map.h')
-rw-r--r--py/map.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/map.h b/py/map.h
index 7acb5a98a..ce5505571 100644
--- a/py/map.h
+++ b/py/map.h
@@ -6,7 +6,8 @@ typedef struct _mp_map_elem_t {
typedef struct _mp_map_t {
struct {
machine_uint_t all_keys_are_qstrs : 1;
- machine_uint_t used : (8 * sizeof(machine_uint_t) - 1);
+ machine_uint_t table_is_fixed_array : 1;
+ machine_uint_t used : (8 * sizeof(machine_uint_t) - 2);
};
machine_uint_t alloc;
mp_map_elem_t *table;
@@ -27,6 +28,7 @@ typedef enum _mp_map_lookup_kind_t {
int get_doubling_prime_greater_or_equal_to(int x);
void mp_map_init(mp_map_t *map, int n);
+void mp_map_init_fixed_table(mp_map_t *map, int n, const mp_obj_t *table);
mp_map_t *mp_map_new(int n);
void mp_map_deinit(mp_map_t *map);
void mp_map_free(mp_map_t *map);