10 enum class BlockType : uint8_t
22 template <
size_t BlockSize>
25 uint8_t data[BlockSize];
34 template <
size_t BlockSize>
45 Memory::FastSet(obj.data, 0xFF, BlockSize);
48 obj.data[BlockSize - 1] &= 0xF0;
59 uint8_t last_4bits = obj.data[BlockSize - 1] & 0x0F;
60 return last_4bits == 0x0F;
76 for (
size_t i = 0; i < BlockSize - 1; ++i)
78 if (obj.data[i] != 0xFF)
84 uint8_t last_byte = obj.data[BlockSize - 1];
85 if ((last_byte & 0xF0) != 0xF0)
90 uint8_t last_4bits = last_byte & 0x0F;
91 if (!(last_4bits == 0x0F || last_4bits == 0x00))
171 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]
按最小写入单元对齐的原始块前缀 / Raw block prefix aligned to one minimum write unit.
KeyInfo key
紧跟在块头后的首个键头 / First key header stored right after the block header.
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).