Implement generalized btree push, note the boundary conditions when id=weight

This really just required care around calculating the expected B-tree id
and rbyd id (which are different!).

B-tree append, aka B-tree push with id=weight, is actually the outlier.
We need a B-tree id that can identify the rbyd we're appending to, but
this id itself doesn't exist in the tree yet, which can be a bit tricky.
This commit is contained in:
Christopher Haster
2023-03-07 13:04:57 -06:00
parent d6a2666614
commit 0a3c6b39c1
4 changed files with 276 additions and 36 deletions
+1 -1
View File
@@ -367,12 +367,12 @@ typedef struct lfsr_branch {
} lfsr_branch_t;
typedef struct lfsr_btree {
lfs_size_t weight;
// TODO do we need full tag actually? this fits in a byte?
lfsr_tag_t tag;
// how can we take advantage of byte packing with union alignment?
union {
struct {
lfs_size_t weight;
uint8_t size;
uint8_t buf[LFSR_BTREE_INLINE_SIZE];
} inlined;