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

SWAR byte tests, the lane constants, the arguments, and the lane, mask and word dispatch tables. More...

Go to the source code of this file.

Data Structures

struct  ScrutLaneCfg
 Arguments for the lane calls. More...
struct  ScrutMaskCfg
 Arguments for the mask calls. More...
struct  ScrutWordCfg
 Arguments for the word calls. More...
struct  ScrutLaneNs
 Type of the lane dispatch table. More...
struct  ScrutMaskNs
 Type of the mask dispatch table. More...
struct  ScrutWordNs
 Type of the word dispatch table. More...

Macros

#define MMGR_SWAR_BYTES
 Expands to sizeof(embed_word), and that is how many lanes one word carries.
#define MMGR_SWAR_LANE_BITS
 Expands to EMBED_WORD_BITS, the width of a whole word in bits.
#define MMGR_SWAR_ONES
 Expands to a word with 1 in every lane, which is 0x0101...01.
#define MMGR_VERBUM_SCRUTOR_HIGH
 Expands to a word with 0x80 in every lane, which is 0x8080...80.
#define MMGR_SWAR_LOW7
 Expands to a word with 0x7F in every lane, which is 0x7F7F...7F.
#define MMGR_SWAR_GO
 Expands to 0, the first of three verdicts a scan step can report.
#define MMGR_SWAR_YES
 Expands to 1, the second of the three verdicts described at MMGR_SWAR_GO.
#define MMGR_SWAR_NO
 Expands to 2, the third of the three verdicts described at MMGR_SWAR_GO.
#define MMGR_FAM_CS
 Expands to 0x60u, the two bits that separate the ASCII blocks a character can fall in.
#define MMGR_FAM_CI
 Expands to 0x40u, the value the MMGR_FAM_CS bits take across the 0x40 to 0x5F block.

Functions

EMBED_HOST_DEVICE embed_word mmgr_scrut_ge (const ScrutLaneCfg *args)
 Marks the lanes of args->word that are at or above args->byte.
EMBED_HOST_DEVICE embed_word mmgr_scrut_le (const ScrutLaneCfg *args)
 Marks the lanes of args->word that are at or below args->byte.
EMBED_HOST_DEVICE embed_word mmgr_scrut_sub7 (const ScrutLaneCfg *args)
 Subtracts args->byte from every lane of args->word and retains the low seven bits of each result.
EMBED_HOST_DEVICE embed_word mmgr_scrut_has_zero (const ScrutLaneCfg *args)
 Marks the lanes of args->word that hold zero.
EMBED_HOST_DEVICE embed_word mmgr_scrut_eq (const ScrutLaneCfg *args)
 Marks the lanes of args->word that equal args->byte.
EMBED_HOST_DEVICE embed_word mmgr_scrut_xor (const ScrutLaneCfg *args)
 Returns the lane by lane difference of args->word and args->val.
EMBED_HOST_DEVICE embed_word mmgr_scrut_fam_eq (const ScrutLaneCfg *args)
 Marks the lanes of args->word that match args->byte once both reduce to the args->fam bits.
EMBED_HOST_DEVICE embed_word mmgr_scrut_any_upper (const ScrutLaneCfg *args)
 Marks the lanes of args->word whose MMGR_FAM_CS bits equal MMGR_FAM_CI, the 0x40 to 0x5F block.
EMBED_HOST_DEVICE embed_word mmgr_scrut_any_digit (const ScrutLaneCfg *args)
 Marks the lanes of args->word that fall in the 0x30 to 0x3F block.
EMBED_HOST_DEVICE embed_word mmgr_scrut_alpha (const ScrutLaneCfg *args)
 Marks the lanes of args->word with an ASCII character, of either case.
EMBED_HOST_DEVICE size_t mmgr_scrut_lane_count (const ScrutLaneCfg *args)
 Counts the set lanes of args->mask.
EMBED_HOST_DEVICE size_t mmgr_scrut_lane_lo (const ScrutLaneCfg *args)
 Returns the index of the lowest set lane of args->mask.
EMBED_HOST_DEVICE size_t mmgr_scrut_lane_hi (const ScrutLaneCfg *args)
 Returns the index of the highest set lane of args->mask.
EMBED_HOST_DEVICE embed_word mmgr_scrut_spread (const ScrutMaskCfg *args)
 Widens every set lane of args->mask from its high bit to a full byte of ones.
EMBED_HOST_DEVICE embed_word mmgr_scrut_drop_lo (const ScrutMaskCfg *args)
 Clears the lowest set lane of args->mask.
EMBED_HOST_DEVICE embed_word mmgr_scrut_drop_hi (const ScrutMaskCfg *args)
 Clears the highest set lane of args->mask.
EMBED_HOST_DEVICE embed_word mmgr_scrut_bytes_below (const ScrutMaskCfg *args)
 Builds a mask over the first args->bytes bytes of a word, in memory order.
EMBED_HOST_DEVICE embed_word mmgr_scrut_lanes_below (const ScrutMaskCfg *args)
 Builds a lane mask over the first args->bytes lanes of a word, in memory order.
EMBED_HOST_DEVICE embed_word mmgr_scrut_lanes_before (const ScrutMaskCfg *args)
 Returns the lanes that come before the first set lane of args->mask, in memory order.
EMBED_HOST_DEVICE embed_word mmgr_scrut_tail_mask (const ScrutMaskCfg *args)
 Builds the lane mask for the last partial word of a scan of args->bytes bytes.
EMBED_HOST_DEVICE embed_word mmgr_scrut_run (const ScrutMaskCfg *args)
 Marks the lanes of args->mask that begin a run of args->bytes set lanes.
EMBED_HOST_DEVICE embed_word mmgr_scrut_run_edge (const ScrutMaskCfg *args)
 Marks the lanes too near the end of a word for a run of args->bytes to fit inside it.
EMBED_HOST_DEVICE embed_word mmgr_scrut_load (const ScrutWordCfg *args)
 Loads one embed_word from args->at.
EMBED_HOST_DEVICE embed_word mmgr_scrut_load_al (const ScrutWordCfg *args)
 Loads one embed_word from an aligned args->at.
EMBED_HOST_DEVICE embed_word mmgr_scrut_fold_lower (const ScrutWordCfg *args)
 Returns args->word with every character lane turned to lower case.
EMBED_HOST_DEVICE size_t mmgr_scrut_words (const ScrutWordCfg *args)
 Returns how many whole words a scan of args->bytes bytes must read.

Variables

static const ScrutLaneNs lane
 Dispatch table instance named lane.
static const ScrutMaskNs mask
 Dispatch table instance named mask.
static const ScrutWordNs verbum
 Dispatch table instance named verbum, with each member set to its mmgr_scrut_ function.

Detailed Description

SWAR byte tests, the lane constants, the arguments, and the lane, mask and word dispatch tables.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-08-29
Note
One embed_word counts as MMGR_SWAR_BYTES independent lanes. One test covers a whole word at once.
A lane mask carries one set bit per lane that matches, in that lane's high bit. mask.spread widens it.
The entries whose sense depends on byte order bind through EMBED_BIG_ENDIAN in the tables below.

Definition in file verbum_scrutor.h.