| 33 | } |
| 34 | |
| 35 | void *intmap_get_(const struct intmap *map, intmap_index_t index) |
| 36 | { |
| 37 | /* Not empty map? */ |
| 38 | if (!intmap_empty_(map)) { |
| 39 | const struct intmap *n = map; |
| 40 | /* Anything with NULL value is a node. */ |
| 41 | while (!n->v) { |
| 42 | /* FIXME: compare cmp prefix, if not equal, ENOENT */ |
| 43 | u8 direction = (index >> critbit(n)) & 1; |
| 44 | n = &n->u.n->child[direction]; |
| 45 | } |
| 46 | if (index == n->u.i) |
| 47 | return n->v; |
| 48 | } |
| 49 | errno = ENOENT; |
| 50 | return NULL; |
| 51 | } |
| 52 | |
| 53 | static bool split_node(struct intmap *n, intmap_index_t nodeindex, |
| 54 | intmap_index_t index, const void *value) |
nothing calls this directly
no test coverage detected