Reworked tag representation so that sup/sub types have expected order

Previously the subtype was encoded above the suptype. This was an issue
if you wanted to, say, traverse all tags in a given suptype.

I'm not sure yet if this sort of functionality is needed, it may be
useful for cleaning up/replacing classes of tags, such as file struct
tags, but not sure yet. At the very least is avoids unintuitive tag
ordering in the tree, which could potential cause problems for
create/deletes.

New encoding:

  tags:
  iiiiiii iiiiitt ttTTTTT TTT0trv
              ^----^--------^-^^^- 16-bit id
                   '--------|-'||- 5-bit suptype (split)
                            '--||- 8-bit subtype
                               '|- perturb/remove bit
                                '- valid bit
  lllllll lllllll lllllll lllllll
                                ^- n-bit length

  alts:
  wwwwwww wwwwwww wwwwwww www1dcv
                            ^^^-^- 28-bit weight
                             '|-|- color bit
                              '-|- direction bit
                                '- valid bit
  jjjjjjj jjjjjjj jjjjjjj jjjjjjj
                                ^- n-bit jump

Also a large amount of name changes and other cleanup.
This commit is contained in:
Christopher Haster
2023-01-15 14:01:09 -06:00
parent 1d037f4ec9
commit 4aabb8f631
4 changed files with 1845 additions and 1819 deletions
+2 -2
View File
@@ -329,7 +329,7 @@ typedef struct lfs_cache {
uint8_t *buffer;
} lfs_cache_t;
typedef struct lfs_rbyd {
typedef struct lfsr_rbyd {
lfs_block_t block;
lfs_off_t trunk;
lfs_off_t off;
@@ -337,7 +337,7 @@ typedef struct lfs_rbyd {
uint32_t crc;
uint16_t count;
bool erased;
} lfs_rbyd_t;
} lfsr_rbyd_t;
typedef struct lfs_mdir {
lfs_block_t pair[2];