Typedefed lfsr_shrub_t -> lfsr_rbyd_t, replacing lfsr_bshrub_t union
The lfsr_shrub_t/lfsr_btree_t union was _technically_ not undefined
behavior, because the relevant fields were all a part of the "common
initial sequence", but collapsing these to the same type certainly does
simplify things.
The only weirdness is that we now store shrub.estimate in shrub.eoff.
We could add a union here, but the extra noise is just not worth the
slighty better name. The shrub.estimate is a sort of "simulated
shrub.eoff" anyways.
---
This makes it so all of these types alias to the same core lfsr_rbyd_t
type, which I suppose actually reflects the on-disk format quite well:
lfsr_shrub_t => lfsr_rbyd_t
lfsr_bshrub_t
lfsr_btree_t
Code cost more-or-less unaffected:
code stack ctx
before: 36432 2608 640
after: 36436 (+0.0%) 2608 (+0.0%) 640 (+0.0%)
This commit is contained in:
@@ -1097,19 +1097,19 @@ code = '''
|
||||
lfsr_mdir_commit(&lfs, &file.o.o.mdir, LFSR_RATS(
|
||||
LFSR_RAT_SHRUBCOMMIT(
|
||||
LFSR_TAG_SHRUBCOMMIT, 0,
|
||||
&file.o.bshrub.u.bshrub, 0, ((lfsr_rat_t[]){
|
||||
&file.o.bshrub, 0, ((lfsr_rat_t[]){
|
||||
LFSR_RAT(LFSR_TAG_DATA, +1, LFSR_DATA_BUF("?", 1))}),
|
||||
1))) => 0;
|
||||
lfsr_mdir_commit(&lfs, &file.o.o.mdir, LFSR_RATS(
|
||||
LFSR_RAT_SHRUBCOMMIT(
|
||||
LFSR_TAG_SHRUBCOMMIT, 0,
|
||||
&file.o.bshrub.u.bshrub, 0, ((lfsr_rat_t[]){
|
||||
&file.o.bshrub, 0, ((lfsr_rat_t[]){
|
||||
LFSR_RAT(LFSR_TAG_RM, -1, LFSR_DATA_NULL())}),
|
||||
1))) => 0;
|
||||
lfsr_mdir_commit(&lfs, &file.o.o.mdir, LFSR_RATS(
|
||||
LFSR_RAT_SHRUBTRUNK(
|
||||
LFSR_TAG_SUB | LFSR_TAG_SHRUBTRUNK, 0,
|
||||
&file.o.bshrub.u.bshrub))) => 0;
|
||||
&file.o.bshrub))) => 0;
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
@@ -1224,16 +1224,16 @@ code = '''
|
||||
|
||||
// create an empty btree
|
||||
lfs_alloc_ckpoint(&lfs);
|
||||
lfsr_rbyd_alloc(&lfs, &file.o.bshrub.u.btree) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &file.o.bshrub.u.btree, 0, LFSR_RATS(
|
||||
lfsr_rbyd_alloc(&lfs, &file.o.bshrub) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &file.o.bshrub, 0, LFSR_RATS(
|
||||
LFSR_RAT(LFSR_TAG_DATA, +1, LFSR_DATA_BUF("?", 1)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &file.o.bshrub.u.btree, 0, LFSR_RATS(
|
||||
lfsr_rbyd_commit(&lfs, &file.o.bshrub, 0, LFSR_RATS(
|
||||
LFSR_RAT(LFSR_TAG_RM, -1, LFSR_DATA_NULL()))) => 0;
|
||||
uint8_t buf[LFSR_BTREE_DSIZE];
|
||||
lfsr_mdir_commit(&lfs, &file.o.o.mdir, LFSR_RATS(
|
||||
LFSR_RAT(
|
||||
LFSR_TAG_SUB | LFSR_TAG_BTREE, 0,
|
||||
LFSR_DATA_BTREE(&file.o.bshrub.u.btree, buf)))) => 0;
|
||||
LFSR_DATA_BTREE(&file.o.bshrub, buf)))) => 0;
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user