38 if (left != 0U && right > (SIZE_MAX / left)) {
41 *result = left * right;
64 const size_t alignment = _Alignof(max_align_t);
65 const size_t remainder = cursor % alignment;
66 const size_t padding = (remainder == 0U) ? 0U : alignment - remainder;
67 if (cursor > (SIZE_MAX - padding) || (cursor + padding) > (SIZE_MAX - bytes)) {
70 *offset = cursor + padding;
71 *next = *offset + bytes;
77 if (budget == 0U || need ==
nullptr) {
117 return (offset <= total) && (bytes <= (total - offset)) &&
118 ((offset % _Alignof(max_align_t)) == 0U);
122 size_t backing_bytes,
126 if (backing ==
nullptr || need ==
nullptr || workspace ==
nullptr || need->
total_bytes == 0U ||
127 need->
total_bytes > backing_bytes || (((uintptr_t)backing % _Alignof(max_align_t)) != 0U) ||
139 uint8_t*
const bytes = (uint8_t*)backing;
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_keycache_cell_t ra8_vmem_frame_t
Per-frame cache metadata (one caller-owned array entry per frame).
Private host sink and caller-owned workspace contracts for reader_vmem.
@ k_rv_frame_bytes
Bytes per cache frame.
@ k_rv_bucket_count
Cache hash-bucket count.
static RA8_INTERNAL bool internal_region_valid(size_t offset, size_t bytes, size_t total)
Check one region lies wholly inside a workspace high-water.
bool priv_rv_workspace_require(uint32_t budget, rv_workspace_need_t *need)
Query exact split-region requirements for one frame budget.
static RA8_INTERNAL bool internal_size_mul(size_t left, size_t right, size_t *result)
Multiply two sizes without wrapping.
static RA8_INTERNAL bool internal_region(size_t cursor, size_t bytes, size_t *offset, size_t *next)
Place one maximally aligned region after a prior high-water.
bool priv_rv_workspace_bind(void *backing, size_t backing_bytes, const rv_workspace_need_t *need, rv_workspace_t *workspace)
Bind typed cache views into an aligned caller-owned backing.
The (object_id, frame-aligned offset) key the page cache hashes on.
Exact byte regions required for one cache budget.
size_t meta_offset
Metadata region offset.
size_t bucket_offset
Hash-bucket region offset.
size_t frame_bytes
Frame-pool region size.
size_t meta_bytes
Metadata region size.
size_t bucket_bytes
Hash-bucket region size.
size_t total_bytes
Exact workspace high-water.
size_t key_offset
Key region offset.
size_t frame_offset
Frame-pool region offset.
size_t key_bytes
Key region size.
Typed views carved from a caller's workspace.