MMgr v1.0.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
impensa_ancorae_acus.h
Go to the documentation of this file.
1/* MMgr - Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2 * SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Commercial OR LicenseRef-Educational
3 *
4 * Every use falls under AGPL-3.0-or-later unless you hold explicit permission, which is either a
5 * negotiated commercial licensing contract or an educator's license issued to you personally.
6 */
7/**
8 * @file impensa_ancorae_acus.h
9 * @brief Byte cost lookup: its argument, the call, and the ancorae dispatch table.
10 * @author dstroy0 (Douglas Quigg) <dquigg123@gmail.com>
11 * @date 2026-08-29
12 *
13 * @note Five source files define the call, each with its own table. A build links exactly one.
14 */
15#ifndef MMGR_IMPENSA_ANCORAE_ACUS_H
16#define MMGR_IMPENSA_ANCORAE_ACUS_H
17
18#include "mmgr.h"
19
20EMBED_BEGIN_DECLS
21
22/**
23 * @brief Argument for the cost lookup.
24 */
25typedef struct
26{
27 const uint8_t byte; /**< Byte value to look up. */
29
30/**
31 * @brief Type of the ancorae dispatch table.
32 *
33 * @note EMBED_TABLE_LAYOUT asserts the impensa member is at offset 0 and that the struct holds nothing else.
34 */
35typedef struct
36{
37 uint8_t (*impensa)(const AncoraeCfg *args); /**< Cost of one byte value. */
39EMBED_TABLE_LAYOUT(ImpensaAncoraeAcusNs, impensa);
40
41/**
42 * @brief Returns the cost of args->byte under the table this build links.
43 *
44 * @param[in] args Byte to look up [BORROWS].
45 * @return The cost, 1 through 255.
46 * @note Lower means the byte is rarer under the linked table. cellul_pick_rows keeps the lowest it
47 * finds.
48 * @warning args is dereferenced without a null check, and so it must point to a readable AncoraeCfg.
49 * @warning The value depends on which of the five tables was linked, and so it is not portable between builds.
50 */
51uint8_t mmgr_ancorae_impensa(const AncoraeCfg *args);
52
53/**
54 * @brief Dispatch table instance named ancorae, whose impensa member is mmgr_ancorae_impensa.
55 */
56EMBED_TABLE_STORAGE ImpensaAncoraeAcusNs ancorae EMBED_UNUSED = {
57 .impensa = mmgr_ancorae_impensa,
58};
59
60EMBED_END_DECLS
61
62#endif
uint8_t mmgr_ancorae_impensa(const AncoraeCfg *args)
Returns the cost of args->byte under the table this build links.
static const ImpensaAncoraeAcusNs ancorae
Dispatch table instance named ancorae, whose impensa member is mmgr_ancorae_impensa.
The embedded_types headers every module builds on.
Argument for the cost lookup.
const uint8_t byte
Type of the ancorae dispatch table.
uint8_t(*) impensa(const AncoraeCfg *args)