MMgr v1.0.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
mmgr_vector.h File Reference

The lane, embedded_types' 256-bit unit beside the word, as the walks of memoria_operor and cellularum_laboro take it. More...

#include <stddef.h>
#include <stdint.h>
#include "embed_lane.h"

Go to the source code of this file.

Macros

#define MMGR_VECTOR_OFF
#define MMGR_VECTOR_BYTES
#define MMGR_VECTOR_MASK_OF(bytes_)
 The mask of the first bytes_ of a lane.

Typedefs

typedef embed_lane_mask MmgrVectorMask
 The bytes of a lane as a mask, one bit a byte, the first byte lowest.

Functions

static size_t mmgr_vector_mask_first (MmgrVectorMask lanes)
 The index of the first byte set in a mask.
static MmgrVectorMask mmgr_vector_mask_before (MmgrVectorMask lanes)
 The bytes before the first byte set in a mask, every byte where none is set.

Detailed Description

The lane, embedded_types' 256-bit unit beside the word, as the walks of memoria_operor and cellularum_laboro take it.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-10-29
Note
A walk steps a word at a time through verbum_scrutor's lanes. The same walk first takes whole lanes, MMGR_VECTOR_BYTES at a step, and leaves the word walk the rest. The questions a walk asks of a word are the ones asked here of a lane: which bytes hold zero, which bytes two lanes differ in, and the first byte set in a mask.
The lane is embed_lane, the target's widest vector register, derived by embedded_types as the word is: 512 bits under AVX-512, 256 under AVX2, 128 under SSE2 or NEON, the word's width where the target has no vector unit. MMGR_VECTOR_BYTES is EMBED_LANE_BYTES, and 0 where MMGR_VECTOR_OFF is 1, which leaves the word walks alone. A wider register in a later build widens every walk here with no edit. Every arm of every gate is defined. A mask holds one bit a byte, the first byte lowest.
Warning
mmgr_vector_load and mmgr_vector_put are unaligned, for a walk over bytes it was given a count of, which keeps every read within them. A walk over text ended by a zero, whose cap may reach far past the text, loads through mmgr_vector_load_aligned alone, at an address a multiple of MMGR_VECTOR_BYTES: an aligned lane never crosses a page, and a read past the text's end stays in the page the text ends in, as the word walk's does.

Definition in file mmgr_vector.h.

Macro Definition Documentation

◆ MMGR_VECTOR_OFF

#define MMGR_VECTOR_OFF

Definition at line 40 of file mmgr_vector.h.

◆ MMGR_VECTOR_BYTES

#define MMGR_VECTOR_BYTES

Definition at line 49 of file mmgr_vector.h.

◆ MMGR_VECTOR_MASK_OF

#define MMGR_VECTOR_MASK_OF ( bytes_)

The mask of the first bytes_ of a lane.

Definition at line 60 of file mmgr_vector.h.

Typedef Documentation

◆ MmgrVectorMask

typedef embed_lane_mask MmgrVectorMask

The bytes of a lane as a mask, one bit a byte, the first byte lowest.

Definition at line 55 of file mmgr_vector.h.

Function Documentation

◆ mmgr_vector_mask_first()

size_t mmgr_vector_mask_first ( MmgrVectorMask lanes)
inlinestatic

The index of the first byte set in a mask.

Parameters
[in]lanesA mask with at least one byte set.
Returns
The byte, counted from the first.

Definition at line 69 of file mmgr_vector.h.

References mmgr_vector_mask_first().

Referenced by mmgr_vector_mask_first().

◆ mmgr_vector_mask_before()

MmgrVectorMask mmgr_vector_mask_before ( MmgrVectorMask lanes)
inlinestatic

The bytes before the first byte set in a mask, every byte where none is set.

Parameters
[in]lanesBytes that end a walk.
Returns
The bytes a match counts in.

Definition at line 81 of file mmgr_vector.h.

References mmgr_vector_mask_before().

Referenced by mmgr_vector_mask_before().