summaryrefslogtreecommitdiff
path: root/source/storage/b_tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/storage/b_tree.c')
-rw-r--r--source/storage/b_tree.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/storage/b_tree.c b/source/storage/b_tree.c
index 4b42496..6a0e76d 100644
--- a/source/storage/b_tree.c
+++ b/source/storage/b_tree.c
@@ -1,14 +1,25 @@
1 1
2// TODO(nasr): 2// TODO(nasr): 1. splitting the tree when getting too big? (horizontally) 2. joining trees?
3// 1. splitting the tree when getting too big? (horizontally)
4// 2. joining trees?
5 3
6 4internal b_tree_node *
7internal void 5node_alloc(mem_arena *arena)
8b_tree_create(mem_arena *arena, u16 order)
9{ 6{
7 b_tree_node *node = PushStructZero(arena, type);
8 node->leaf = 1;
9 return node;
10}
10 11
12// NOTE(nasr): @return the index of of the found element
13internal i32
14node_find_pos(mem_arena *arena, string8 value)
15{
16 i32 i = 0;
17 while (i < n->key_count && str8_cmp(n->keys[i], k) < 0)
18 {
19 ++i;
20 }
11 21
22 return i;
12} 23}
13 24
14// NOTE(nasr): nodes that get passed as parameters should've already been loaded into memory 25// NOTE(nasr): nodes that get passed as parameters should've already been loaded into memory