Adopted mask bits for tag lookup/append
This lets us cram in one more mask for potential redund bits:
name tag mask
LFSR_TAG_MASK0 0x0000 0x0fff ---- 1111 1111 1111
LFSR_TAG_MASK2 0x1000 0x0ffc ---- 1111 1111 11--
LFSR_TAG_MASK8 0x2000 0x0f00 ---- 1111 ---- ----
LFSR_TAG_MASK12 0x3000 0x0000 ---- ---- ---- ----
'.-' '.-' '---.---'
mode bits -' | | ^
suptype ------' | |
subtype --------------' |
redund bits ------------------'
I toyed around with a bitwise alternative to the lookup table, but
couldn't come up with anything simpler than these:
- 0xfff & ~((((1<<((i>>1)*8))-1) << ((i&1)*4)) | ((1<<(i*2))-1))
- 0xfff & ~((1 << (((i>>1)*8)+((i&1)<<(1+(i>>1)))))-1)
- 0xfff & ~((1<<(2*i*i))-1) (requires multiply and 32-bit shift)
---
This also replaces the mdir/rbyd/btree/mtree lookup/sublookup/suplookup
functions with a single flexible lookup function that accepts tag masks.
This ended up adding a bit of code/stack (the extra NULL args are
surprisingly pricey), but will hopefully make the redund bits
easier/cheaper to use:
code stack ctx
before: 35548 2472 636
after: 35584 (+0.1%) 2480 (+0.3%) 636 (+0.0%)
This commit is contained in:
@@ -979,7 +979,7 @@ code = '''
|
||||
// delete any bshrub/btree
|
||||
lfsr_mdir_commit(&lfs, &file.b.o.mdir, LFSR_RATTRS(
|
||||
LFSR_RATTR(
|
||||
LFSR_TAG_RM | LFSR_TAG_SUB | LFSR_TAG_STRUCT, 0))) => 0;
|
||||
LFSR_TAG_RM | LFSR_TAG_MASK8 | LFSR_TAG_STRUCT, 0))) => 0;
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
@@ -1111,7 +1111,7 @@ code = '''
|
||||
.rattr_count=1})))) => 0;
|
||||
lfsr_mdir_commit(&lfs, &file.b.o.mdir, LFSR_RATTRS(
|
||||
LFSR_RATTR_SHRUB(
|
||||
LFSR_TAG_SUB | LFSR_TAG_BSHRUB, 0,
|
||||
LFSR_TAG_MASK8 | LFSR_TAG_BSHRUB, 0,
|
||||
&file.b.shrub_))) => 0;
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
@@ -1234,7 +1234,7 @@ code = '''
|
||||
LFSR_RATTR(LFSR_TAG_RM, -1))) => 0;
|
||||
lfsr_mdir_commit(&lfs, &file.b.o.mdir, LFSR_RATTRS(
|
||||
LFSR_RATTR_BTREE(
|
||||
LFSR_TAG_SUB | LFSR_TAG_BTREE, 0,
|
||||
LFSR_TAG_MASK8 | LFSR_TAG_BTREE, 0,
|
||||
&file.b.shrub))) => 0;
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
Reference in New Issue
Block a user