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

Byte-level memory work: its arguments, the calls, and the memor dispatch table. More...

#include "mmgr.h"

Go to the source code of this file.

Data Structures

struct  MemoriaCfg
 Arguments for the memor calls. More...
struct  MemoriaOperorNs
 Type of the memor dispatch table. More...

Functions

void mmgr_memor_cpy (const MemoriaCfg *args)
 Copies args->bytes from args->src to args->dst, walking upward.
void mmgr_memor_move_up (const MemoriaCfg *args)
 Copies args->bytes from args->src to args->dst, walking downward from the far end.
embed_iword mmgr_memor_cmp (const MemoriaCfg *args)
 Compares args->bytes of args->src against args->other.
const void * mmgr_memor_chr (const MemoriaCfg *args)
 Finds the first byte in args->src equal to args->val, within args->bytes.
void mmgr_memor_set (const MemoriaCfg *args)
 Writes args->val into args->bytes of args->dst.

Variables

static const MemoriaOperorNs memor
 Dispatch table instance named memor.

Detailed Description

Byte-level memory work: its arguments, the calls, and the memor dispatch table.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-08-29

Definition in file memoria_operor.h.

Function Documentation

◆ mmgr_memor_cpy()

void mmgr_memor_cpy ( const MemoriaCfg * args)

Copies args->bytes from args->src to args->dst, walking upward.

Parameters
[in]argsDestination, source and count [BORROWS].
Note
Moves whole words first, then the remaining bytes one at a time.
Warning
The backend's argument type qualifies both pointers restrict, and so the regions must not overlap.
args->dst must be writable and args->src readable for args->bytes.

References mmgr_memor_cpy().

Referenced by mmgr_memor_cpy().

◆ mmgr_memor_move_up()

void mmgr_memor_move_up ( const MemoriaCfg * args)

Copies args->bytes from args->src to args->dst, walking downward from the far end.

Parameters
[in]argsDestination, source and count [BORROWS].
Note
Works back from the end. An args->dst above args->src is safe even when the regions overlap.
Warning
args->dst must be writable and args->src readable for args->bytes.

References mmgr_memor_move_up().

Referenced by mmgr_memor_move_up().

◆ mmgr_memor_cmp()

embed_iword mmgr_memor_cmp ( const MemoriaCfg * args)

Compares args->bytes of args->src against args->other.

Parameters
[in]argsThe two regions and the count [BORROWS].
Returns
The difference of the first unequal byte pair, or 0 when every byte matches.
Note
The sign follows the differing bytes, and so the result orders the two regions.
Warning
Both regions must be readable for args->bytes rounded up to a whole word, since a count that does not fill the last one is still read a whole word at a time.

References mmgr_memor_cmp().

Referenced by mmgr_memor_cmp().

◆ mmgr_memor_chr()

const void * mmgr_memor_chr ( const MemoriaCfg * args)

Finds the first byte in args->src equal to args->val, within args->bytes.

Parameters
[in]argsRegion, count and the byte sought [BORROWS].
Returns
Address of the match, or NULL when the byte does not occur [BORROWS].
Note
A terminator is not special. All args->bytes are searched.
Warning
args->src must be readable for args->bytes rounded up to a whole word, since a count that does not fill the last one is still read a whole word at a time.

References mmgr_memor_chr().

Referenced by mmgr_memor_chr().

◆ mmgr_memor_set()

void mmgr_memor_set ( const MemoriaCfg * args)

Writes args->val into args->bytes of args->dst.

Parameters
[in]argsDestination, count and the byte to write [BORROWS].
Note
Stores whole words built from args->val, then finishes byte by byte.
Warning
args->dst must be writable for args->bytes.

References mmgr_memor_set().

Referenced by mmgr_memor_set().

Variable Documentation

◆ memor

const MemoriaOperorNs memor
static

Dispatch table instance named memor.

Note
cpy and move_down both point at mmgr_memor_cpy. Every other member has its own function.
mmgr_memor_move_down is not declared. A destination below the source is what the upward walk already handles, and so the table names that walk twice instead of carrying a second copy of it.

Definition at line 110 of file memoria_operor.h.