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

Endian reads and writes: the width enum, the argument type, the five entry points and the two order tables. More...

#include "mmgr.h"

Go to the source code of this file.

Data Structures

struct  EndianCfg
 Arguments for the endian calls, where each call reads only the members it needs. More...
struct  EndianNs
 Type of an endian dispatch table. More...

Enumerations

enum  mmgr_endian_width {
  MMGR_ENDIAN_16 ,
  MMGR_ENDIAN_32 ,
  MMGR_ENDIAN_64
}
 Width of one endian read or write, counted in bytes. More...

Functions

EMBED_HOST_DEVICE size_t mmgr_wr_le (const EndianCfg *args)
 Writes args->width bytes of args->val to args->dst and does not reverse them.
EMBED_HOST_DEVICE uint64_t mmgr_rd_le (const EndianCfg *args)
 Reads args->width bytes from args->src and does not reverse them.
EMBED_HOST_DEVICE size_t mmgr_wr_be (const EndianCfg *args)
 Reverses args->val, then writes args->width bytes of it to args->dst.
EMBED_HOST_DEVICE uint64_t mmgr_rd_be (const EndianCfg *args)
 Reads args->width bytes from args->src, then reverses them.
EMBED_HOST_DEVICE uint64_t mmgr_endian_rev (const EndianCfg *args)
 Reverses the byte order of args->val at args->width bytes.

Variables

static const EndianNs parva_extremitas
 Dispatch table instance named parva_extremitas, the little endian order.
static const EndianNs magna_extremitas
 Dispatch table instance named magna_extremitas, the big endian order.

Detailed Description

Endian reads and writes: the width enum, the argument type, the five entry points and the two order tables.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-08-29
Note
parva_extremitas moves bytes in the host's own order and magna_extremitas in the reverse of it. Nothing here consults EMBED_BIG_ENDIAN, and so the two names hold on a little endian host and are for the opposite orders on a big endian one.
The two tables share the table type and the rev entry. Their wr and rd differ, since one pair reverses and the other does not.

Definition in file endian.h.