10enum class BlockType : uint8_t
22template <
size_t BlockSize>
25 uint8_t data[BlockSize];
34template <
size_t BlockSize>
45 Memory::FastSet(obj.data, 0xFF, BlockSize);
48 obj.data[BlockSize - 1] &= 0xF0;
66 for (
size_t i = 0; i < BlockSize; ++i)
68 if (obj.data[i] != 0xFF)
89 for (
size_t i = 0; i < BlockSize - 1; ++i)
91 if (obj.data[i] != 0xFF)
97 uint8_t last_byte = obj.data[BlockSize - 1];
98 if ((last_byte & 0xF0) != 0xF0)
103 uint8_t last_4bits = last_byte & 0x0F;
104 if (!(last_4bits == 0x0F || last_4bits == 0x00))
185 Memory::FastSet(
padding, 0xFF, MinWriteSize);
读写对齐布尔位图块的工具 Helpers for reading and writing aligned boolean flag blocks.
static bool Valid(const BlockBoolData< BlockSize > &obj)
检查位图块内容是否仍是合法编码 / Check whether a flag block still contains a valid encoding.
static void SetFlag(BlockBoolData< BlockSize > &obj, bool value)
把一个布尔值编码进位图块 / Encode one boolean value into a flag block.
static bool ReadFlag(const BlockBoolData< BlockSize > &obj)
从位图块读取布尔值 / Decode one boolean value from a flag block.
按最小写入单元存放布尔位图块 Boolean flag block stored in one aligned write unit span.
Flash 存储的块信息结构 Structure representing a Flash storage block.
uint8_t padding[MinWriteSize]
FlashInfo()
构造一个擦除态 FlashInfo 缓冲对象 Construct one erased-state FlashInfo buffer object.
uint32_t header
Flash 块头签名 / Flash block-header signature.
键信息结构,存储键的元数据 Structure containing key metadata.
BlockBoolData< MinWriteSize > uninit
该键是否未初始化
BlockBoolData< MinWriteSize > available_flag
该键是否有效
uint32_t GetDataSize() const
获取数据字节数 / Get the payload size in bytes.
void SetNameLength(uint8_t len)
设置键名长度 / Set the key name length.
BlockBoolData< MinWriteSize > no_next_key
是否是最后一个键
void SetDataSize(uint32_t size)
设置数据字节数 / Set the payload size in bytes.
KeyInfo()
构造一个默认可写的键头元数据 Construct one default writable key-header metadata object.
uint8_t GetNameLength() const
获取键名长度 / Get the key name length.