38 PANIC(
"Should never happen");
74 return srn_errors_make_error(ctx, metadata,
ABSURD,
"expected a map");
srn_value_t * srn_value_make(srn_context_t *ctx, srn_value_tag_t tag, srn_metadata_t *metadata, void *payload)
Creates a new serene value.
#define AS_MAP(value_ref)
#define IS_A(value_ref, field)
hmap_t hmap_empty(srn_context_t *ctx)
Create, initialize and return a new hashmap.
void * hmap_lookup_ctl(const hmap_control_t *ctl, srn_context_t *ctx, const hmap_t *hmap, const hmap_key_t *k, void *default_value)
Just like the hmap_lookup function but, it receives a hmap_control_t to customize the comparison and ...
hmap_key_t * hmap_make_key(srn_context_t *ctx, void *data, size_t len)
Create a new key out of the given data, with the given len.
hmap_t hmap_insert_ctl(const hmap_control_t *ctl, srn_context_t *ctx, const hmap_t *hmap, hmap_key_t *k, void *v)
Just like the hmap_insert function but, it receives a hmap_control_t to customize the comparison and ...
This is an implementation of Compressed Hash-Array Mapped Prefix-tree, which is a bit-partitioned,...
HMAP_HASH_TYPE hmap_hash_t
srn_value_t * srn_map_assoc(srn_context_t *ctx, srn_metadata_t *metadata, srn_value_t *map, srn_value_t *key, srn_value_t *value)
static hmap_hash_t srn_vmap_hash(srn_context_t *ctx, const hmap_key_t *k)
srn_value_t * srn_map_empty(srn_context_t *ctx, srn_metadata_t *metadata)
static bool srn_vmap_cmp(srn_context_t *ctx, const hmap_key_t *a, const hmap_key_t *b)
static const hmap_control_t value_map
srn_value_t * srn_value_eq(srn_context_t *ctx, const srn_value_t *a, const srn_value_t *b)
Check to values for equality. Return a boolean.
srn_hash_t srn_value_hash(srn_context_t *ctx, const srn_value_t *v)
Compute the xxHash32 of a value using the engine seed.
If we ever want to modify some of these behaviours for a new instance of hashmap, we should use this ...
Note: For key equality we use the memcpy function.
void * data
len 0 -> data == nullptr
A persistent, immutable map.
#define PANIC_IF_NULL(ptr)