MMgr v2.3.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 impensa_ancorae_acus.c defines the call. Five profile files each define one table, and a build links
14 * exactly one of them.
15 */
16#ifndef MMGR_IMPENSA_ANCORAE_ACUS_H
17#define MMGR_IMPENSA_ANCORAE_ACUS_H
18
19/** @addtogroup mod_anchor
20 * @{ */
21
22#include "mmgr.h"
23
24EMBED_BEGIN_DECLS
25
26/**
27 * @brief Argument for the cost lookup.
28 */
29typedef struct
30{
31 const uint8_t byte; /**< Byte value to look up. */
33
34/**
35 * @brief Type of the ancorae dispatch table.
36 *
37 * @note EMBED_TABLE_LAYOUT asserts the impensa member is at offset 0 and that the struct holds nothing else.
38 */
39typedef struct
40{
41 uint8_t (*impensa)(const AncoraeCfg *args); /**< Cost of one byte value. */
43EMBED_TABLE_LAYOUT(ImpensaAncoraeAcusNs, impensa);
44
45/**
46 * @brief Cost of each byte value under the profile this build links, indexed by the byte itself.
47 *
48 * @note The profile file that the build selects defines it, and mmgr_ancorae_impensa reads it.
49 * @note Under nvcc the table has a device twin, mmgr_ancorae_impensa_table_device, from the same initializer. A
50 * read names the table through EMBED_PASS_NAME, and so a kernel reads the twin in device memory.
51 */
52EMBED_PASS_DECLARE(const uint8_t, mmgr_ancorae_impensa_table, [256]);
53
54/**
55 * @brief Returns the cost of args->byte under the table this build links.
56 *
57 * @param[in] args Byte to look up [BORROWS].
58 * @return The cost, 1 through 255.
59 * @note Lower means the byte is rarer under the linked table. cellul_pick_rows retains the lowest it
60 * finds.
61 * @warning The read through args has no null check, and so it must point to a readable AncoraeCfg.
62 * @warning The value depends on which of the five tables the build linked, and so it is not portable between builds.
63 */
64EMBED_HOST_DEVICE uint8_t mmgr_ancorae_impensa(const AncoraeCfg *args);
65
66/**
67 * @brief Dispatch table instance named ancorae, whose impensa member is mmgr_ancorae_impensa.
68 */
69EMBED_TABLE_STORAGE ImpensaAncoraeAcusNs ancorae EMBED_UNUSED = {
70 .impensa = mmgr_ancorae_impensa,
71};
72
73EMBED_END_DECLS
74
75/** @} */
76
77#endif
EMBED_HOST_DEVICE uint8_t mmgr_ancorae_impensa(const AncoraeCfg *args)
Returns the cost of args->byte under the table this build links.
EMBED_PASS_DECLARE(const uint8_t, mmgr_ancorae_impensa_table, [256])
Cost of each byte value under the profile this build links, indexed by the byte itself.
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)