+/* Returns the first node in MAP in the bucket for HASH, or a null pointer if
+ that bucket in HASH is empty.
+
+ This function runs in constant time.
+
+ Nodes are returned in arbitrary order that may change whenever the hash
+ table's current capacity changes, as reported by hmap_capacity(). Calls to
+ hmap_insert(), hmap_reserve(), and hmap_shrink() can change the capacity of
+ a hash map. Inserting a node with hmap_insert_fast() or deleting one with
+ hmap_delete() will not change the relative ordering of nodes.
+
+ The HMAP_FOR_EACH_IN_BUCKET and HMAP_FOR_EACH_IN_BUCKET_SAFE macros provide
+ convenient ways to iterate over all the nodes with a given hash. The
+ HMAP_FIRST_IN_BUCKET macro is an interface to this particular function that
+ is often more convenient. */
+static inline struct hmap_node *
+hmap_first_in_bucket (const struct hmap *map, size_t hash)
+{
+ return map->buckets[hash & map->mask];
+}
+
+/* Returns the next node following NODE within the same bucket, or a null
+ pointer if NODE is the last node in its bucket.
+
+ This function runs in constant time.
+
+ Nodes are returned in arbitrary order that may change whenever the hash
+ table's current capacity changes, as reported by hmap_capacity(). Calls to
+ hmap_insert(), hmap_reserve(), and hmap_shrink() can change the capacity of
+ a hash map. Inserting a node with hmap_insert_fast() or deleting one with
+ hmap_delete() will not change the relative ordering of nodes.
+
+ The HMAP_FOR_EACH_IN_BUCKET and HMAP_FOR_EACH_IN_BUCKET_SAFE macros provide
+ convenient ways to iterate over all the nodes with a given hash. The
+ HMAP_NEXT_IN_BUCKET macro is an interface to this particular function that
+ is often more convenient. */
+static inline struct hmap_node *
+hmap_next_in_bucket (const struct hmap_node *node)
+{
+ return node->next;
+}
+