Reverted lfsr_data_t lazily encoded leb128s

- It didn't save code.

- An inlined buffer is potentially more useful, even if only marginally,
  and, uh, unproven yet.

- Requiring lfs_toleb128 in a readonly implementation is a hard ask.
This commit is contained in:
Christopher Haster
2024-02-25 12:31:32 -06:00
parent 415e148f62
commit 692810e18e
4 changed files with 97 additions and 86 deletions
+13 -7
View File
@@ -399,11 +399,17 @@ typedef struct lfs_mdir {
// Either an on-disk or in-device data pointer
//
// The top 2 bits of data's size indicates the actual encoding
// 0b00 => in-RAM buffer
// 0b01 => a single leb128
// 0b10 => on-disk reference
// 0b11 => concatenated datas
// The sign-bit of the size field indicates if the data is
// in-device or on-disk.
//
// After removing the sign bit, the size always encodes the
// resulting size on-disk.
//
// The exact representation of in-device data also depends on the
// mode field:
// - pointer to a RAM-backed buffer
// - inlined data able to fit at least 1 leb128
// - an array of concatenated datas
//
// Note concatenated datas can only be 1 level deep. Concatenating
// concatenated datas would require recursion to resolve.
@@ -422,8 +428,8 @@ typedef struct lfsr_data {
} buf;
struct {
lfs_ssize_t size;
uint32_t word;
} word;
uint8_t buf[8];
} imm;
struct {
lfs_ssize_t size;
const struct lfsr_data *datas;