[libc-commits] [libc] [libc] Use Block as a byte-backed proxy (PR #201001)
Daniel Thornburgh via libc-commits
libc-commits at lists.llvm.org
Fri Jun 5 14:53:57 PDT 2026
================
@@ -90,48 +98,69 @@ using cpp::optional;
///
/// The next offset of a block matches the previous offset of its next block.
/// The first block in a list is denoted by having a previous offset of `0`.
-class Block {
- // Masks for the contents of the next_ field.
+class BlockRef {
+ // Masks for the contents of the next field.
static constexpr size_t PREV_FREE_MASK = 1 << 0;
static constexpr size_t LAST_MASK = 1 << 1;
static constexpr size_t SIZE_MASK = ~(PREV_FREE_MASK | LAST_MASK);
+ // Header field offsets. The previous offset is only meaningful when this
+ // block's PREV_FREE_MASK bit is set in the next field.
+ static constexpr size_t PREV_OFFSET = 0;
+ static constexpr size_t NEXT_OFFSET = sizeof(size_t);
----------------
mysterymath wrote:
nit: `= PREV_OFFSET + sizeof(size_t)`
This gives the same form to the expression below.
https://github.com/llvm/llvm-project/pull/201001
More information about the libc-commits
mailing list