summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/v2/hashtable.h
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 01:01:41 +0700
committerpolwex <polwex@sortug.com>2025-10-06 01:01:41 +0700
commitc4b392a179048f936c062f5ffccc2bc25627e500 (patch)
tree09be0904be8ec4d7ea52992ef7580d42ed0c28c1 /vere/pkg/noun/v2/hashtable.h
working
Diffstat (limited to 'vere/pkg/noun/v2/hashtable.h')
-rw-r--r--vere/pkg/noun/v2/hashtable.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/vere/pkg/noun/v2/hashtable.h b/vere/pkg/noun/v2/hashtable.h
new file mode 100644
index 0000000..2278640
--- /dev/null
+++ b/vere/pkg/noun/v2/hashtable.h
@@ -0,0 +1,42 @@
+#ifndef U3_HASHTABLE_V2_H
+#define U3_HASHTABLE_V2_H
+
+#define u3h_v2_buck u3h_buck
+#define u3h_v2_free u3h_free
+#define u3h_v2_new u3h_new
+#define u3h_v2_node u3h_node
+#define u3h_v2_noun_to_slot u3h_noun_to_slot
+#define u3h_v2_root u3h_root
+#define u3h_v2_slot_is_node u3h_slot_is_node
+#define u3h_v2_slot_is_noun u3h_slot_is_noun
+#define u3h_v2_slot_to_noun u3h_slot_to_noun
+#define u3h_v2_walk u3h_walk
+#define u3h_v2_walk_with u3h_walk_with
+
+#include "../hashtable.h"
+
+#include "c3/c3.h"
+#include "types.h"
+
+ /** Data structures.
+ **/
+
+ /** HAMT macros.
+ ***
+ *** Coordinate with u3_noun definition!
+ **/
+ /* u3h_v2_slot_to_node(): slot to node pointer
+ ** u3h_v2_node_to_slot(): node pointer to slot
+ */
+# define u3h_v2_slot_to_node(sot) (u3a_v2_into(((sot) & 0x3fffffff) << u3a_vits))
+# define u3h_v2_node_to_slot(ptr) ((u3a_v2_outa((ptr)) >> u3a_vits) | 0x40000000)
+
+ /** Functions.
+ ***
+ **/
+ /* u3h_v2_rewrite(): rewrite hashtable for compaction.
+ */
+ void
+ u3h_v2_rewrite(u3p(u3h_root) har_p);
+
+#endif /* U3_HASHTABLE_V2_H */