forked from Imagelibrary/littlefs
Tweaked alt-tag encoding to match color/dir naming order
This is mainly to avoid mistakes caused by names/encodings disagreeing:
LFSR_TAG_ALT 0x4kkk v1cd kkkk -kkk kkkk
^ ^^ '------+-----'
'-||--------|------- valid bit
'|--------|------- color
'--------|------- dir
'------- key
Notably, the LFSR_TAG_ALT() macro has already caused issues by being
both 1. ambiguous, and 2. not really type-checkable. It's easy to get
the order wrong and things not really break, just behave poorly, it's
really not great!
To be honest the exact order is a bit arbitrary, the color->dir naming
appeared by accident because I guess it felt more natural. Maybe because
of English's weird implicit adjective ordering? Maybe because of how
often conditions show up as the last part of the name in other
instruction sets?
At least one plus is that this moves the dir-bit next to the key. This
makes it so all of the condition information is encoding is the lowest
13-bits of the tag, which may lead to minor optimization tricks for
implementing flips and such.
Code changes:
code stack
before: 34080 2864
after: 34068 (-0.0%) 2864 (+0.0%)
This commit is contained in:
@@ -40,8 +40,8 @@ TAG_SHRUB = 0x1000
|
||||
TAG_CKSUM = 0x3000
|
||||
TAG_ECKSUM = 0x3100
|
||||
TAG_ALT = 0x4000
|
||||
TAG_GT = 0x2000
|
||||
TAG_R = 0x1000
|
||||
TAG_R = 0x2000
|
||||
TAG_GT = 0x1000
|
||||
|
||||
|
||||
# some ways of block geometry representations
|
||||
|
||||
Reference in New Issue
Block a user