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

The binary64 field layout and scale bounds, the assertions that pin them, the six entry points and the fract table. More...

#include "mmgr.h"

Go to the source code of this file.

Data Structures

struct  FractioCfg
 Pins the two scale bounds to the values binary64 gives. More...
struct  FractioNs
 Type of the fract dispatch table. More...

Macros

#define MMGR_DBL_SIGN_MASK
 The binary64 field layout: three masks, the sign shift, the two field widths, the two whole field values and the exponent bias.
#define MMGR_DBL_EXP_MASK
#define MMGR_DBL_MANT_MASK
#define MMGR_DBL_SIGN_SHIFT
#define MMGR_DBL_MANT_BITS
#define MMGR_DBL_EXP_BITS
#define MMGR_DBL_SIGN_ONE
#define MMGR_DBL_EXP_ALL
#define MMGR_DBL_BIAS
#define MMGR_DBL_BITS
 The width of a double in bits, bytes and embed_word units.
#define MMGR_DBL_BYTES
#define MMGR_DBL_WORDS
#define MMGR_DBL_SCALE_MAX
 Pins the target's double to the width and storage this file assumes.
#define MMGR_DBL_SCALE_MIN

Functions

EMBED_HOST_DEVICE embed_u64 mmgr_fract_sign (const FractioCfg *args)
 Returns the sign bit of args->bits.
EMBED_HOST_DEVICE embed_u64 mmgr_fract_exp (const FractioCfg *args)
 Returns the exponent field of args->bits.
EMBED_HOST_DEVICE embed_u64 mmgr_fract_mant (const FractioCfg *args)
 Returns the mantissa field of args->bits.
EMBED_HOST_DEVICE embed_u64 mmgr_fract_merge (const FractioCfg *args)
 Packs args->sign, args->exp and args->mant into one bit pattern.
EMBED_HOST_DEVICE double mmgr_fract_from_bits (const FractioCfg *args)
 Reads the union as a double.
EMBED_HOST_DEVICE embed_u64 mmgr_fract_to_bits (const FractioCfg *args)
 Reads the union as a bit pattern.

Variables

static const FractioNs fract
 Dispatch table instance named fract, whose members are the mmgr_fract_ entries.

Detailed Description

The binary64 field layout and scale bounds, the assertions that pin them, the six entry points and the fract table.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-08-29
Note
Everything here is for binary64. The assertions below are what hold the target to it, and they are EMBED_STATIC_ASSERT. A target whose double is another shape fails the build and does not read the wrong bits.
FractioCfg carries no pointer, and so no call here follows one into a caller's buffer. The whole module is field arithmetic on the one value it receives.
Warning
args is the single one pointer the six entry points take, and not one of them tests it. The bodies EMBED_ENTRY writes read its members straight through. A null args faults.

Definition in file fractio.h.