MMgr v2.3.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
cellularum_laboro.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 cellularum_laboro.h
9 * @brief Bounded string work: the three argument types, the calls, and the cellul dispatch table.
10 * @author dstroy0 (Douglas Quigg) <dquigg123@gmail.com>
11 * @date 2026-08-29
12 *
13 * @note A cap the caller states bounds the calls that take CatenaFinitaCfg. So no walk runs
14 * past it even where the bytes carry no terminator. That bound makes these usable
15 * where a libc string call is not. An absent terminator stops a walk and does not
16 * run it off the end.
17 * @note ws and digit are the exception. Each reads the single byte at args->at and never consults
18 * cap, because a one byte test has nothing to run past.
19 * @note The TransfiguroCfg conversions carry no bound at all. Each reads until the first byte that is
20 * not part of the number, and so the caller owes them such a byte inside readable storage. A
21 * terminator is the usual one.
22 * @note The VerboProgrediorCfg pair take their operands by value and read no memory, and so
23 * neither carries a bound.
24 * @warning Nothing here allocates or passes back ownership. Every pointer in and out is the caller's,
25 * and the addresses find and chr return point into the src they received.
26 */
27#ifndef MMGR_CELLULARUM_LABORO_H
28#define MMGR_CELLULARUM_LABORO_H
29
30/** @addtogroup mod_cellul
31 * @{ */
32
34
35#include "mmgr.h"
36
37EMBED_BEGIN_DECLS
38
39/**
40 * @brief Max needle offsets the search sieve tests per candidate word.
41 *
42 * @note A ceiling and not a count. cellul_pick_rows takes the smallest of this, the needle length
43 * and MMGR_SWAR_BYTES. A short needle gets a sieve on fewer offsets than this allows.
44 * @note cellul_find_core sizes two arrays by it, the chosen offsets and their broadcasts, and reads
45 * element 0 of each outside the loop that walks the rest.
46 * @warning Taken only when MMGR_SIEVE_ROWS is not already defined. A build may supply its own.
47 * @warning A build's own value must be at least 1. At 0 both arrays have zero length and the
48 * search still reads element 0 of each, and nothing here asserts against it.
49 */
50#ifndef MMGR_SIEVE_ROWS
51
52#define MMGR_SIEVE_ROWS 1u
53#endif
54
55/**
56 * @brief Longest haystack over which a mask chain, and not a sieve, settles a one or two byte
57 * needle.
58 *
59 * @note Case sensitive searches only. The chain compares its broadcasts with no fold. A
60 * folded search takes the sieve at every length, whatever value this holds.
61 * @note Defaults to no limit, which folds the test away: `read_cap <= SIZE_MAX` is true for every
62 * size_t. A default build emits no comparison and chooses no second path at run time.
63 * @note The chain settles every start position in a word at once, with no anchor to choose and
64 * nothing to verify afterwards. A two byte needle costs it a second read a step and a one byte
65 * needle none. The sieve picks its offsets out of the cost table before it reads a haystack
66 * byte. It reads a word per offset on top of the one it tests for the terminator. Then it
67 * proves every lane that survives in full. Measured with a two byte needle, cycles for the whole call:
68 *
69 * n 8 64 2048
70 * Xtensa chain 124 489 13391
71 * Xtensa sieve 187 607 15494
72 * RISC-V chain 124 488 13393
73 * RISC-V sieve 219 680 17059
74 *
75 * The chain wins at every length on both parts, and so the default is no limit. The knob
76 * stays because that is a measurement and not a proof. A part or a workload that
77 * disagrees can say so and leave the walk alone.
78 * @warning Taken only when MMGR_FIND_CHAIN_MAX is not already defined. A build may supply its own.
79 * Zero sends every needle through the sieve.
80 */
81#ifndef MMGR_FIND_CHAIN_MAX
82
83#define MMGR_FIND_CHAIN_MAX SIZE_MAX
84#endif
85
86/**
87 * @brief Arguments for the string calls, where each call reads only the members it needs.
88 *
89 * @note Members left unset are zero, and the calls that ignore them never read them.
90 */
91typedef struct
92{
93 const char *const src; /**< Bytes to read [BORROWS]. */
94 const size_t cap; /**< Bytes readable from src, and for copy the bytes writable at dst. */
95 const char *const other; /**< Second operand for diff, eq, starts, find and has [BORROWS]. */
96 const size_t other_cap; /**< Bytes readable from other. */
97 const size_t other_len; /**< Needle length find and has take when non-zero, in place of a measure. */
98 char *const dst; /**< Destination for copy [BORROWS]. */
99 const size_t at; /**< Offset into src for len, ws and digit. */
100 const uint8_t byte; /**< Byte sought by chr. */
101 const embed_bool ci; /**< Fold case in diff, eq, starts, find and has. */
103
104/**
105 * @brief Arguments for the single-step compares used to drive a walk.
106 *
107 * @note step_word reads word_left and word_right. step_byte reads byte_left and byte_right.
108 * @note Both operands come by value, and so neither call reads memory and neither needs a bound.
109 */
110typedef struct
111{
112 const embed_word word_left; /**< First word for step_word. */
113 const embed_word word_right; /**< Second word for step_word. */
114 const uint8_t byte_left; /**< First byte for step_byte. */
115 const uint8_t byte_right; /**< Second byte for step_byte. */
116 const embed_bool ci; /**< Fold case before the compare. */
117 const embed_bool end_wins; /**< A terminator in the same lane counts as a match. */
119
120/**
121 * @brief Arguments for the conversions from text to number.
122 *
123 * @note Every one of them reads src, and sets end when the caller passes one. Only to_ulong_in reads base.
124 */
125typedef struct
126{
127 const char *const src; /**< Text to convert [BORROWS]. */
128 const char **const end; /**< Optional target set past the number, or back to src when no number came [BORROWS]. */
129 const unsigned int base; /**< Base of to_ulong_in: 2 to 36, or 0 for the base that the number's prefix names. */
131
132/**
133 * @brief Type of the cellul dispatch table.
134 *
135 * @note EMBED_TABLE_LAYOUT asserts the twenty-three members sit at consecutive EMBED_FUNCTION_POINTER_BYTES offsets,
136 * with nothing else.
137 * @note Byte and wire verbs are not here. rd_str and mpint_fixed read a length off the wire instead
138 * of out of a string. So they belong to the byteio module and act on its spans.
139 */
140typedef struct
141{
142 CatenaFinitaCfg (*init)(const CatenaFinitaCfg *args); /**< Copies the argument struct. */
143 size_t (*len)(const CatenaFinitaCfg *args); /**< Bytes before the terminator. */
144 size_t (*diff)(const CatenaFinitaCfg *args); /**< Offset of the first byte that differs. */
145 embed_bool (*eq)(const CatenaFinitaCfg *args); /**< Whether both end together with no difference. */
146 embed_bool (*starts)(const CatenaFinitaCfg *args); /**< Whether src begins with other. */
147 const char *(*find)(const CatenaFinitaCfg *args); /**< First occurrence of other in src. */
148 embed_bool (*has)(const CatenaFinitaCfg *args); /**< Whether find would report a match. */
149 const char *(*chr)(const CatenaFinitaCfg *args); /**< First occurrence of byte in src. */
150 size_t (*copy)(const CatenaFinitaCfg *args); /**< Bounded copy, terminated unless cap is 0. */
151 embed_bool (*ws)(const CatenaFinitaCfg *args); /**< Whether src[at] is whitespace. */
152 embed_bool (*digit)(const CatenaFinitaCfg *args); /**< Whether src[at] is a decimal digit. */
153 embed_iword (*step_word)(const VerboProgrediorCfg *args); /**< One word compare that drives a walk. */
154 embed_iword (*step_byte)(const VerboProgrediorCfg *args); /**< One byte compare that drives a walk. */
155 embed_iword (*to_long)(const TransfiguroCfg *args); /**< Text to signed integer. */
156 embed_word (*to_ulong)(const TransfiguroCfg *args); /**< Text to unsigned integer. */
157 double (*to_double)(const TransfiguroCfg *args); /**< Text to double. */
158 float (*to_float)(const TransfiguroCfg *args); /**< Text to float. */
159 embed_word (*to_ulong_in)(const TransfiguroCfg *args); /**< Text to unsigned integer, in a base. */
160 size_t (*span)(const CatenaFinitaCfg *args); /**< Bytes at the start of src that other holds. */
161 size_t (*span_not)(const CatenaFinitaCfg *args); /**< Bytes at the start of src that other does not hold. */
162 const char *(*chr_last)(const CatenaFinitaCfg *args); /**< Last occurrence of byte in src. */
163 size_t (*span_last)(const CatenaFinitaCfg *args); /**< Bytes at the end of src that other holds. */
164 size_t (*span_not_last)(const CatenaFinitaCfg *args); /**< Bytes at the end of src that other does not hold. */
166EMBED_TABLE_LAYOUT(CellularumLaboroNs, init, len, diff, eq, starts, find, has, chr, copy, ws, digit, step_word,
167 step_byte, to_long, to_ulong, to_double, to_float, to_ulong_in, span, span_not, chr_last, span_last,
168 span_not_last);
169
170/**
171 * @brief Returns a copy of the argument struct.
172 *
173 * @param[in] args Struct to copy [BORROWS].
174 * @return A copy of *args.
175 * @note Copies the members only. It reads nothing they point at.
176 */
177EMBED_HOST_DEVICE CatenaFinitaCfg mmgr_cellul_init(const CatenaFinitaCfg *args);
178
179/**
180 * @brief Returns the bytes in src before its terminator, from args->at on.
181 *
182 * @param[in] args Bytes src, the extent cap, and the start offset at [BORROWS].
183 * @return Bytes before the terminator, at max cap minus at.
184 * @note Returns cap minus at when no terminator lies in range.
185 * @warning args->at must not exceed args->cap, and src must be readable to args->cap. The last partial
186 * word comes in whole and gets a mask after. So the read reaches up to MMGR_SWAR_BYTES - 1 bytes past cap.
187 */
188EMBED_HOST_DEVICE size_t mmgr_cellul_len(const CatenaFinitaCfg *args);
189
190/**
191 * @brief Returns the offset of the first byte where src and other differ.
192 *
193 * @param[in] args Bytes src and other, the extent cap, and ci [BORROWS].
194 * @return Offset of the first difference, or cap when the two agree throughout.
195 * @note A terminator does not end the scan. cap is the only bound.
196 * @warning Both src and other must be readable for cap bytes. The last partial word comes in whole and
197 * gets a mask after. The read reaches up to MMGR_SWAR_BYTES - 1 bytes past cap in each.
198 */
199EMBED_HOST_DEVICE size_t mmgr_cellul_diff(const CatenaFinitaCfg *args);
200
201/**
202 * @brief Reports whether src and other hold the same terminated string.
203 *
204 * @param[in] args Bytes src and other, the extent cap, and ci [BORROWS].
205 * @return EMBED_TRUE when both reach a terminator with no difference before it.
206 * @warning Both src and other must be readable for cap bytes. The last partial word comes in whole and
207 * gets a mask after. The read reaches up to MMGR_SWAR_BYTES - 1 bytes past cap in each.
208 */
209EMBED_HOST_DEVICE embed_bool mmgr_cellul_eq(const CatenaFinitaCfg *args);
210
211/**
212 * @brief Reports whether src begins with other.
213 *
214 * @param[in] args Bytes src and other, the extent cap, and ci [BORROWS].
215 * @return EMBED_TRUE when other reaches its terminator with no difference before it.
216 * @note An empty other matches any src.
217 * @warning Both src and other must be readable for cap bytes. The last partial word comes in whole and
218 * gets a mask after. The read reaches up to MMGR_SWAR_BYTES - 1 bytes past cap in each.
219 */
220EMBED_HOST_DEVICE embed_bool mmgr_cellul_starts(const CatenaFinitaCfg *args);
221
222/**
223 * @brief Finds the first occurrence of other within src.
224 *
225 * @param[in] args Haystack src with cap, needle other with other_cap, and ci [BORROWS].
226 * @return Address inside src, or NULL when there is no match [BORROWS].
227 * @note An empty needle returns src. A needle longer than cap returns NULL.
228 * @warning src must be readable for cap bytes and other for other_cap bytes. The needle comes in a
229 * whole word at a time and gets a mask after. So the read reaches up to MMGR_SWAR_BYTES - 1
230 * bytes past other_cap. The haystack walk holds itself inside cap.
231 */
232EMBED_HOST_DEVICE const char *mmgr_cellul_find(const CatenaFinitaCfg *args);
233
234/**
235 * @brief Reports whether other occurs within src.
236 *
237 * @param[in] args Haystack src with cap, needle other with other_cap, and ci [BORROWS].
238 * @return EMBED_TRUE when mmgr_cellul_find reports a match.
239 * @warning src must be readable for cap bytes and other for other_cap bytes, with the needle read past
240 * other_cap exactly as mmgr_cellul_find describes.
241 */
242EMBED_HOST_DEVICE embed_bool mmgr_cellul_has(const CatenaFinitaCfg *args);
243
244/**
245 * @brief Finds the first occurrence of args->byte in src, before the terminator.
246 *
247 * @param[in] args Bytes src, the extent cap, and the byte sought [BORROWS].
248 * @return Address inside src, or NULL when the byte does not occur [BORROWS].
249 * @note A byte of 0 returns the terminator's own address, or src plus cap when no terminator is in range.
250 * @warning src must be readable for cap bytes. The last partial word comes in whole and gets a mask after.
251 * The read reaches up to MMGR_SWAR_BYTES - 1 bytes past cap.
252 */
253EMBED_HOST_DEVICE const char *mmgr_cellul_chr(const CatenaFinitaCfg *args);
254
255/**
256 * @brief Copies src into dst, and writes at max cap bytes, the terminator among them.
257 *
258 * @param[in,out] args Source src, destination dst, and the destination extent cap [BORROWS].
259 * @return Bytes copied, with the terminator not in the count.
260 * @note A cap of 0 writes nothing at all and not even a terminator.
261 * @warning dst must be writable for cap bytes and src readable for cap minus one.
262 */
263EMBED_HOST_DEVICE size_t mmgr_cellul_copy(const CatenaFinitaCfg *args);
264
265/**
266 * @brief Tests src[at] for whitespace.
267 *
268 * @param[in] args Bytes src and the offset at [BORROWS].
269 * @return EMBED_TRUE for space, tab, newline, carriage return, form feed or vertical tab.
270 * @warning src[at] must be readable. cap does not bound this call.
271 */
272EMBED_HOST_DEVICE embed_bool mmgr_cellul_ws(const CatenaFinitaCfg *args);
273
274/**
275 * @brief Tests src[at] for a decimal digit.
276 *
277 * @param[in] args Bytes src and the offset at [BORROWS].
278 * @return EMBED_TRUE for the ten decimal digits, '0' through '9'.
279 * @warning src[at] must be readable. cap does not bound this call.
280 */
281EMBED_HOST_DEVICE embed_bool mmgr_cellul_digit(const CatenaFinitaCfg *args);
282
283/**
284 * @brief Compares one word pair and reports whether a walk should continue.
285 *
286 * @param[in] args Words word_left and word_right, with ci and end_wins [BORROWS].
287 * @return MMGR_SWAR_GO to continue, MMGR_SWAR_YES on agreement, MMGR_SWAR_NO on difference.
288 * @note MMGR_SWAR_YES means word_left's terminator arrived before the first difference.
289 * @note end_wins makes a terminator in the same lane as the difference count as agreement.
290 */
291EMBED_HOST_DEVICE embed_iword mmgr_cellul_step_word(const VerboProgrediorCfg *args);
292
293/**
294 * @brief Compares one byte pair and reports whether a walk should continue.
295 *
296 * @param[in] args Bytes byte_left and byte_right, with ci and end_wins [BORROWS].
297 * @return MMGR_SWAR_GO to continue, MMGR_SWAR_YES on agreement, MMGR_SWAR_NO on difference.
298 * @note A byte_left that terminates gives MMGR_SWAR_YES when byte_right also terminates, or when
299 * end_wins holds.
300 */
301EMBED_HOST_DEVICE embed_iword mmgr_cellul_step_byte(const VerboProgrediorCfg *args);
302
303/**
304 * @brief Reads a signed decimal integer from args->src.
305 *
306 * @param[in,out] args Text src and the optional end target [BORROWS].
307 * @return The value, negated when a minus sign came first.
308 * @note Skips leading whitespace, then accepts one optional '+' or '-'.
309 * @note When end is not NULL the call sets it past the last digit, or back to src when no digit came.
310 * @warning The read stops at the first byte that is not part of the number. No length bounds it.
311 * @warning The digit accumulator is embed_word wide and wraps on a longer run.
312 */
313EMBED_HOST_DEVICE embed_iword mmgr_cellul_to_long(const TransfiguroCfg *args);
314
315/**
316 * @brief Reads an unsigned decimal integer from args->src.
317 *
318 * @param[in,out] args Text src and the optional end target [BORROWS].
319 * @return The accumulated value.
320 * @note Skips leading whitespace, then accepts one optional '+'. A '-' stops the read.
321 * @note When end is not NULL the call sets it past the last digit, or back to src when no digit came.
322 * @warning The read stops at the first byte that is not part of the number. No length bounds it.
323 * @warning The digit accumulator is embed_word wide and wraps on a longer run.
324 */
325EMBED_HOST_DEVICE embed_word mmgr_cellul_to_ulong(const TransfiguroCfg *args);
326
327/**
328 * @brief Reads a decimal floating point number from args->src.
329 *
330 * @param[in,out] args Text src and the optional end target [BORROWS].
331 * @return The assembled value.
332 * @note Accepts whitespace, one optional sign, digits, one optional point, then an optional exponent.
333 * @note The exponent counts only when at least one digit came before it.
334 * @note When end is not NULL the call sets it past the number, or back to src when no digit came.
335 * @warning The read stops at the first byte that is not part of the number. No length bounds it.
336 */
337EMBED_HOST_DEVICE double mmgr_cellul_to_double(const TransfiguroCfg *args);
338
339/**
340 * @brief Reads a decimal floating point number from args->src and narrows it to float.
341 *
342 * @param[in,out] args Text src and the optional end target [BORROWS].
343 * @return The value from mmgr_cellul_to_double, narrowed to float.
344 * @note Accepts the same input as mmgr_cellul_to_double, with only a different result width.
345 * @warning The read stops at the first byte that is not part of the number. No length bounds it.
346 */
347EMBED_HOST_DEVICE float mmgr_cellul_to_float(const TransfiguroCfg *args);
348
349/**
350 * @brief Reads an unsigned integer in base args->base from args->src.
351 *
352 * @param[in,out] args Text src, the optional end target and the base [BORROWS].
353 * @return The value, negated in its word when a minus sign came first. All ones where the digits pass
354 * the word, whatever the sign. 0 where the base is neither 0 nor 2 to 36.
355 * @note Skips leading whitespace, then accepts one optional '+' or '-'. A base of 16 then accepts one optional 0x or
356 * 0X before a digit. A base of 0 reads 0x or 0X before a digit as base 16, a leading 0 as base 8, and any
357 * other number as base 10.
358 * @note A digit is '0' to '9', then a letter of either case for 10 to 35, each below the base. muto.take_in adds it.
359 * @note When end is not NULL the call sets it past the last digit, or back to src when no digit came.
360 * @warning The read stops at the first byte that is not a digit of the base. No length bounds it.
361 */
362EMBED_HOST_DEVICE embed_word mmgr_cellul_to_ulong_in(const TransfiguroCfg *args);
363
364/**
365 * @brief Counts the bytes at the start of src that the set other holds.
366 *
367 * @param[in] args Bytes src, the extent cap, and the terminated set other [BORROWS].
368 * @return The count of bytes before the first byte that other does not hold, the terminator or cap.
369 * @note An empty set counts 0.
370 * @warning other must end in a terminator. The aligned words that hold src's first and last bytes are read whole.
371 */
372EMBED_HOST_DEVICE size_t mmgr_cellul_span(const CatenaFinitaCfg *args);
373
374/**
375 * @brief Counts the bytes at the start of src that the set other does not hold.
376 *
377 * @param[in] args Bytes src, the extent cap, and the terminated set other [BORROWS].
378 * @return The count of bytes before the first byte that other holds, the terminator or cap.
379 * @note An empty set counts every byte before the terminator or cap.
380 * @warning other must end in a terminator. The aligned words that hold src's first and last bytes are read whole.
381 */
382EMBED_HOST_DEVICE size_t mmgr_cellul_span_not(const CatenaFinitaCfg *args);
383
384/**
385 * @brief Finds the last occurrence of args->byte in src, before the terminator.
386 *
387 * @param[in] args Bytes src, the extent cap, and the byte sought [BORROWS].
388 * @return Address inside src, or NULL when the byte does not occur [BORROWS].
389 * @note A byte of 0 returns the terminator's own address, or src plus cap when no terminator is in range, as
390 * mmgr_cellul_chr does.
391 * @warning src must be readable for cap bytes.
392 */
393EMBED_HOST_DEVICE const char *mmgr_cellul_chr_last(const CatenaFinitaCfg *args);
394
395/**
396 * @brief Counts the bytes at the end of src's cap bytes that the set other holds.
397 *
398 * @param[in] args Bytes src, the extent cap, and the terminated set other [BORROWS].
399 * @return The count of bytes after the last byte that other does not hold, or cap.
400 * @note The count starts at src plus cap and walks down. A terminator is a byte that no set holds, and it stops the
401 * count.
402 * @note An empty set counts 0.
403 * @warning other must end in a terminator. The aligned words that hold src's first and last bytes are read whole.
404 */
405EMBED_HOST_DEVICE size_t mmgr_cellul_span_last(const CatenaFinitaCfg *args);
406
407/**
408 * @brief Counts the bytes at the end of src's cap bytes that the set other does not hold.
409 *
410 * @param[in] args Bytes src, the extent cap, and the terminated set other [BORROWS].
411 * @return The count of bytes after the last byte that other holds, or cap.
412 * @note The count starts at src plus cap and walks down. A terminator is a byte that no set holds, and the count goes
413 * past it.
414 * @note An empty set counts cap.
415 * @warning other must end in a terminator. The aligned words that hold src's first and last bytes are read whole.
416 */
417EMBED_HOST_DEVICE size_t mmgr_cellul_span_not_last(const CatenaFinitaCfg *args);
418
419/**
420 * @brief Dispatch table instance named cellul, with each member set to its mmgr_cellul_ function.
421 */
422EMBED_TABLE_STORAGE CellularumLaboroNs cellul EMBED_UNUSED = {
423 .init = mmgr_cellul_init,
424 .len = mmgr_cellul_len,
425 .diff = mmgr_cellul_diff,
426 .eq = mmgr_cellul_eq,
427 .starts = mmgr_cellul_starts,
428 .find = mmgr_cellul_find,
429 .has = mmgr_cellul_has,
430 .chr = mmgr_cellul_chr,
431 .copy = mmgr_cellul_copy,
432 .ws = mmgr_cellul_ws,
433 .digit = mmgr_cellul_digit,
434 .step_word = mmgr_cellul_step_word,
435 .step_byte = mmgr_cellul_step_byte,
436 .to_long = mmgr_cellul_to_long,
437 .to_ulong = mmgr_cellul_to_ulong,
438 .to_double = mmgr_cellul_to_double,
439 .to_float = mmgr_cellul_to_float,
440 .to_ulong_in = mmgr_cellul_to_ulong_in,
441 .span = mmgr_cellul_span,
442 .span_not = mmgr_cellul_span_not,
443 .chr_last = mmgr_cellul_chr_last,
444 .span_last = mmgr_cellul_span_last,
445 .span_not_last = mmgr_cellul_span_not_last,
446};
447
448EMBED_END_DECLS
449
450/** @} */
451
452#endif
EMBED_HOST_DEVICE const char * mmgr_cellul_chr(const CatenaFinitaCfg *args)
Finds the first occurrence of args->byte in src, before the terminator.
EMBED_HOST_DEVICE size_t mmgr_cellul_span(const CatenaFinitaCfg *args)
Counts the bytes at the start of src that the set other holds.
EMBED_HOST_DEVICE size_t mmgr_cellul_span_not(const CatenaFinitaCfg *args)
Counts the bytes at the start of src that the set other does not hold.
EMBED_HOST_DEVICE embed_word mmgr_cellul_to_ulong_in(const TransfiguroCfg *args)
Reads an unsigned integer in base args->base from args->src.
EMBED_HOST_DEVICE embed_word mmgr_cellul_to_ulong(const TransfiguroCfg *args)
Reads an unsigned decimal integer from args->src.
EMBED_HOST_DEVICE size_t mmgr_cellul_span_not_last(const CatenaFinitaCfg *args)
Counts the bytes at the end of src's cap bytes that the set other does not hold.
EMBED_HOST_DEVICE embed_bool mmgr_cellul_ws(const CatenaFinitaCfg *args)
Tests src[at] for whitespace.
EMBED_HOST_DEVICE embed_iword mmgr_cellul_to_long(const TransfiguroCfg *args)
Reads a signed decimal integer from args->src.
EMBED_HOST_DEVICE size_t mmgr_cellul_len(const CatenaFinitaCfg *args)
Returns the bytes in src before its terminator, from args->at on.
EMBED_HOST_DEVICE embed_bool mmgr_cellul_has(const CatenaFinitaCfg *args)
Reports whether other occurs within src.
EMBED_HOST_DEVICE const char * mmgr_cellul_find(const CatenaFinitaCfg *args)
Finds the first occurrence of other within src.
EMBED_HOST_DEVICE embed_bool mmgr_cellul_eq(const CatenaFinitaCfg *args)
Reports whether src and other hold the same terminated string.
EMBED_HOST_DEVICE size_t mmgr_cellul_copy(const CatenaFinitaCfg *args)
Copies src into dst, and writes at max cap bytes, the terminator among them.
EMBED_HOST_DEVICE double mmgr_cellul_to_double(const TransfiguroCfg *args)
Reads a decimal floating point number from args->src.
EMBED_HOST_DEVICE embed_bool mmgr_cellul_digit(const CatenaFinitaCfg *args)
Tests src[at] for a decimal digit.
EMBED_HOST_DEVICE CatenaFinitaCfg mmgr_cellul_init(const CatenaFinitaCfg *args)
Returns a copy of the argument struct.
EMBED_HOST_DEVICE embed_iword mmgr_cellul_step_word(const VerboProgrediorCfg *args)
Compares one word pair and reports whether a walk should continue.
EMBED_HOST_DEVICE size_t mmgr_cellul_diff(const CatenaFinitaCfg *args)
Returns the offset of the first byte where src and other differ.
EMBED_HOST_DEVICE size_t mmgr_cellul_span_last(const CatenaFinitaCfg *args)
Counts the bytes at the end of src's cap bytes that the set other holds.
EMBED_HOST_DEVICE const char * mmgr_cellul_chr_last(const CatenaFinitaCfg *args)
Finds the last occurrence of args->byte in src, before the terminator.
static const CellularumLaboroNs cellul
Dispatch table instance named cellul, with each member set to its mmgr_cellul_ function.
EMBED_HOST_DEVICE float mmgr_cellul_to_float(const TransfiguroCfg *args)
Reads a decimal floating point number from args->src and narrows it to float.
EMBED_HOST_DEVICE embed_iword mmgr_cellul_step_byte(const VerboProgrediorCfg *args)
Compares one byte pair and reports whether a walk should continue.
EMBED_HOST_DEVICE embed_bool mmgr_cellul_starts(const CatenaFinitaCfg *args)
Reports whether src begins with other.
The embedded_types headers every module builds on.
Arguments for the string calls, where each call reads only the members it needs.
const size_t other_len
const embed_bool ci
const char *const other
const size_t other_cap
const char *const src
Type of the cellul dispatch table.
embed_iword(*) step_word(const VerboProgrediorCfg *args)
embed_bool(*) digit(const CatenaFinitaCfg *args)
size_t(*) span(const CatenaFinitaCfg *args)
CatenaFinitaCfg(*) init(const CatenaFinitaCfg *args)
embed_bool(*) starts(const CatenaFinitaCfg *args)
double(*) to_double(const TransfiguroCfg *args)
size_t(*) span_not(const CatenaFinitaCfg *args)
embed_iword(*) step_byte(const VerboProgrediorCfg *args)
size_t(*) span_not_last(const CatenaFinitaCfg *args)
embed_bool(*) has(const CatenaFinitaCfg *args)
size_t(*) span_last(const CatenaFinitaCfg *args)
size_t(*) diff(const CatenaFinitaCfg *args)
embed_bool(*) ws(const CatenaFinitaCfg *args)
embed_iword(*) to_long(const TransfiguroCfg *args)
size_t(*) len(const CatenaFinitaCfg *args)
float(*) to_float(const TransfiguroCfg *args)
embed_bool(*) eq(const CatenaFinitaCfg *args)
size_t(*) copy(const CatenaFinitaCfg *args)
embed_word(*) to_ulong(const TransfiguroCfg *args)
embed_word(*) to_ulong_in(const TransfiguroCfg *args)
Arguments for the conversions from text to number.
const unsigned int base
const char *const src
const char **const end
Arguments for the single-step compares used to drive a walk.
const embed_bool ci
const embed_word word_left
const embed_word word_right
const embed_bool end_wins
SWAR byte tests, the lane constants, the arguments, and the lane, mask and word dispatch tables.