MMgr v2.3.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
verbum_scrutor — the SWAR scanner

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

Macro Definition Documentation

◆ MMGR_SWAR_BYTES

#define MMGR_SWAR_BYTES

Expands to sizeof(embed_word), and that is how many lanes one word carries.

Note
Eight at EMBED_WORD_BITS 64, four at 32 and two at 16.
Also the value both lane index calls report when the mask they receive is empty.

Definition at line 36 of file verbum_scrutor.h.

◆ MMGR_SWAR_LANE_BITS

#define MMGR_SWAR_LANE_BITS

Expands to EMBED_WORD_BITS, the width of a whole word in bits.

Note
This is the word's width and not one lane's, despite the name. A lane is eight bits.
Bounds the shift that doubles in scrut_smear and supplies the final shift in scrut_lane_count, both of which want the whole width.

Definition at line 45 of file verbum_scrutor.h.

◆ MMGR_SWAR_ONES

#define MMGR_SWAR_ONES

Expands to a word with 1 in every lane, which is 0x0101...01.

Note
A multiply of it by a byte broadcasts that byte into every lane, and that is how the comparisons start.
A multiply of a lane mask by it sums the lanes, and that is how scrut_lane_count counts them.

Definition at line 53 of file verbum_scrutor.h.

◆ MMGR_VERBUM_SCRUTOR_HIGH

#define MMGR_VERBUM_SCRUTOR_HIGH

Expands to a word with 0x80 in every lane, which is 0x8080...80.

Note
The shape every lane mask takes. A caller can and two masks together lane by lane.
An or of it into a word before a subtraction gives each lane a borrow to spend, which retains lanes apart.

Definition at line 61 of file verbum_scrutor.h.

◆ MMGR_SWAR_LOW7

#define MMGR_SWAR_LOW7

Expands to a word with 0x7F in every lane, which is 0x7F7F...7F.

Note
The complement of MMGR_VERBUM_SCRUTOR_HIGH, and so the two split each lane into its value and its mask bit.
scrut_has_zero adds it to make every non-zero lane carry into its high bit.

Definition at line 69 of file verbum_scrutor.h.

◆ MMGR_SWAR_GO

#define MMGR_SWAR_GO

Expands to 0, the first of three verdicts a scan step can report.

Note
MMGR_SWAR_GO, MMGR_SWAR_YES and MMGR_SWAR_NO are 0, 1 and 2, and so the three fit in one byte.
The three carry no size suffix, and so each takes int in an expression. A scanner that retains a verdict in a uint8_t converts it on the way in.
verbum_scrutor.c reads none of the three. They are here for the scanners that include it.

Definition at line 80 of file verbum_scrutor.h.

◆ MMGR_SWAR_YES

#define MMGR_SWAR_YES

Expands to 1, the second of the three verdicts described at MMGR_SWAR_GO.

Definition at line 83 of file verbum_scrutor.h.

◆ MMGR_SWAR_NO

#define MMGR_SWAR_NO

Expands to 2, the third of the three verdicts described at MMGR_SWAR_GO.

Definition at line 86 of file verbum_scrutor.h.

◆ MMGR_FAM_CS

#define MMGR_FAM_CS

Expands to 0x60u, the two bits that separate the ASCII blocks a character can fall in.

Note
Passed to lane.fam_eq as the family, with MMGR_FAM_CI as the byte, to pick out the capital block.

Definition at line 93 of file verbum_scrutor.h.

◆ MMGR_FAM_CI

#define MMGR_FAM_CI

Expands to 0x40u, the value the MMGR_FAM_CS bits take across the 0x40 to 0x5F block.

Note
That block holds A through Z along with six other bytes: the at sign, and the five that follow Z.

Definition at line 100 of file verbum_scrutor.h.

Function Documentation

◆ mmgr_scrut_ge()

EMBED_HOST_DEVICE embed_word mmgr_scrut_ge ( const ScrutLaneCfg * args)

Marks the lanes of args->word that are at or above args->byte.

Parameters
[in]argsThe word and the byte to compare against [BORROWS].
Returns
A lane mask with those lanes.
Note
Compares bytes as unsigned, and 0x80 and above are the largest values.
Warning
args->byte must be under 0x80. At or above it the lanes under 0x80 come out wrong and nothing diagnoses it.

References mmgr_scrut_ge().

Referenced by mmgr_scrut_ge().

◆ mmgr_scrut_le()

EMBED_HOST_DEVICE embed_word mmgr_scrut_le ( const ScrutLaneCfg * args)

Marks the lanes of args->word that are at or below args->byte.

Parameters
[in]argsThe word and the byte to compare against [BORROWS].
Returns
A lane mask with those lanes.
Note
Compares bytes as unsigned, and 0x80 and above are the largest values.
Warning
args->byte must be under 0x80, for the reason given on mmgr_scrut_ge.
Note
And this with mmgr_scrut_ge to get a range test, as mmgr_scrut_alpha does.

References mmgr_scrut_le().

Referenced by mmgr_scrut_le().

◆ mmgr_scrut_sub7()

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.

Parameters
[in]argsThe word and the byte to subtract [BORROWS].
Returns
The seven low bits of each lane's difference, every lane's high bit clear.
Note
Yields values and not a lane mask, unlike every other lane entry but count, first and last.
Warning
A lane below args->byte wraps, and so its seven bits are the difference taken modulo 128.
args->byte must be under 0x80, for the reason given on mmgr_scrut_ge: at or above it a borrow reaches the next lane.

References mmgr_scrut_sub7().

Referenced by mmgr_scrut_sub7().

◆ mmgr_scrut_has_zero()

EMBED_HOST_DEVICE embed_word mmgr_scrut_has_zero ( const ScrutLaneCfg * args)

Marks the lanes of args->word that hold zero.

Parameters
[in]argsThe word to test [BORROWS].
Returns
A lane mask with the zero lanes.
Note
Reads args->word alone, and byte, val, fam and ci take no part.
Apply this to the result of mmgr_scrut_xor to find where two words agreed.

References mmgr_scrut_has_zero().

Referenced by mmgr_scrut_has_zero().

◆ mmgr_scrut_eq()

EMBED_HOST_DEVICE embed_word mmgr_scrut_eq ( const ScrutLaneCfg * args)

Marks the lanes of args->word that equal args->byte.

Parameters
[in]argsThe word, the byte to find, and the case flag [BORROWS].
Returns
A lane mask with the lanes that match.
Note
Broadcasts args->byte itself, and so the caller passes a single byte and not a whole word.
With args->ci set, a character matches either case. Every other byte still compares exactly.

References mmgr_scrut_eq().

Referenced by mmgr_scrut_eq().

◆ mmgr_scrut_xor()

EMBED_HOST_DEVICE embed_word mmgr_scrut_xor ( const ScrutLaneCfg * args)

Returns the lane by lane difference of args->word and args->val.

Parameters
[in]argsThe two words and the case flag [BORROWS].
Returns
A word whose lanes are zero exactly where the two agreed.
Note
Takes a whole word in args->val, and so the caller broadcasts a byte itself if it wants that.
With args->ci set, the case bit goes to zero on character lanes, and so the two cases of a character agree.
Pass the result to mmgr_scrut_has_zero to turn it into a lane mask.

References mmgr_scrut_xor().

Referenced by mmgr_scrut_xor().

◆ mmgr_scrut_fam_eq()

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.

Parameters
[in]argsThe word, the byte to match, and the bits that count [BORROWS].
Returns
A lane mask with the lanes that match.
Note
args->fam reduces args->byte first, and so bits outside the family take no part on either side.
A args->fam of 0xFF makes this an exact match, and an args->fam of 0 marks every lane.

References mmgr_scrut_fam_eq().

Referenced by mmgr_scrut_fam_eq().

◆ mmgr_scrut_any_upper()

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.

Parameters
[in]argsThe word to test [BORROWS].
Returns
A lane mask with those lanes.
Note
Reads args->word alone, since the family and the byte are both fixed.
Warning
That block holds six bytes that are not capitals, the at sign and the five after Z. Bit seven takes no part, and so 0xC0 to 0xDF gets a mark as well. And it with mmgr_scrut_alpha for characters alone.

References mmgr_scrut_any_upper().

Referenced by mmgr_scrut_any_upper().

◆ mmgr_scrut_any_digit()

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.

Parameters
[in]argsThe word to test [BORROWS].
Returns
A lane mask with those lanes.
Note
Reads args->word alone, since the family and the byte are both fixed.
Warning
That block holds six symbols after the nine, and so this marks more than 0 through 9. And it with mmgr_scrut_le at the character nine when only the ten digits should count.

References mmgr_scrut_any_digit().

Referenced by mmgr_scrut_any_digit().

◆ mmgr_scrut_alpha()

EMBED_HOST_DEVICE embed_word mmgr_scrut_alpha ( const ScrutLaneCfg * args)

Marks the lanes of args->word with an ASCII character, of either case.

Parameters
[in]argsThe word to test [BORROWS].
Returns
A lane mask with the character lanes.
Note
Reads args->word alone, and byte, val, fam and ci take no part.
A byte at 0x80 or above is never marked, and so this is exact where mmgr_scrut_any_upper is not. Beyond the ten digits mmgr_scrut_any_digit marks only the six symbols after the nine and never a high byte.

References mmgr_scrut_alpha().

Referenced by mmgr_scrut_alpha().

◆ mmgr_scrut_lane_count()

EMBED_HOST_DEVICE size_t mmgr_scrut_lane_count ( const ScrutLaneCfg * args)

Counts the set lanes of args->mask.

Parameters
[in]argsThe lane mask to count [BORROWS].
Returns
How many lanes hold, 0 through MMGR_SWAR_BYTES.
Note
Reads args->mask alone, and so word, byte, val, fam and ci take no part.
Warning
Expects a lane mask, one bit per lane in that lane's high bit. A spread mask counts wrong.

References mmgr_scrut_lane_count().

Referenced by mmgr_scrut_lane_count().

◆ mmgr_scrut_lane_lo()

EMBED_HOST_DEVICE size_t mmgr_scrut_lane_lo ( const ScrutLaneCfg * args)

Returns the index of the lowest set lane of args->mask.

Parameters
[in]argsThe lane mask to examine [BORROWS].
Returns
The index, or MMGR_SWAR_BYTES when no lane holds.
Note
The lane table reaches this as first on a little endian target and as last on a big endian one. So prefer lane.first or lane.last when memory order is what matters.
A return of MMGR_SWAR_BYTES is one past the last valid index, and that is how an empty mask reports.

References mmgr_scrut_lane_lo().

Referenced by mmgr_scrut_lane_lo().

◆ mmgr_scrut_lane_hi()

EMBED_HOST_DEVICE size_t mmgr_scrut_lane_hi ( const ScrutLaneCfg * args)

Returns the index of the highest set lane of args->mask.

Parameters
[in]argsThe lane mask to examine [BORROWS].
Returns
The index, or MMGR_SWAR_BYTES when no lane holds.
Note
The lane table reaches this as last on a little endian target and as first on a big endian one. So prefer lane.first or lane.last when memory order is what matters.
A return of MMGR_SWAR_BYTES is one past the last valid index, and that is how an empty mask reports.

References mmgr_scrut_lane_hi().

Referenced by mmgr_scrut_lane_hi().

◆ mmgr_scrut_spread()

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.

Parameters
[in]argsThe lane mask to widen [BORROWS].
Returns
A word with 0xFF in each set lane and 0x00 in the rest.
Note
Use the result to select between two words lane by lane, which a lane mask alone cannot do.
Warning
The result is not a lane mask any more, and so do not hand it to the count or index entries.

References mmgr_scrut_spread().

Referenced by mmgr_scrut_spread().

◆ mmgr_scrut_drop_lo()

EMBED_HOST_DEVICE embed_word mmgr_scrut_drop_lo ( const ScrutMaskCfg * args)

Clears the lowest set lane of args->mask.

Parameters
[in]argsThe lane mask to reduce [BORROWS].
Returns
The mask with that lane cleared, or 0 when it contained only one.
Note
An empty mask stays empty, and a mask that steps down again and again ends and does not wrap.
The mask table reaches this as drop_first on a little endian target and drop_last on a big endian one.

References mmgr_scrut_drop_lo().

Referenced by mmgr_scrut_drop_lo().

◆ mmgr_scrut_drop_hi()

EMBED_HOST_DEVICE embed_word mmgr_scrut_drop_hi ( const ScrutMaskCfg * args)

Clears the highest set lane of args->mask.

Parameters
[in]argsThe lane mask to reduce [BORROWS].
Returns
The mask with that lane cleared, or 0 when it contained only one.
Note
An empty mask stays empty, and a mask that steps down again and again ends and does not wrap.
The mask table reaches this as drop_last on a little endian target and drop_first on a big endian one.

References mmgr_scrut_drop_hi().

Referenced by mmgr_scrut_drop_hi().

◆ mmgr_scrut_bytes_below()

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.

Parameters
[in]argsThe byte count to cover [BORROWS].
Returns
A word of ones over those bytes and zeros over the rest.
Note
Covers the bytes that come first in memory on either byte order.
A count of 0 gives an empty mask and a count of MMGR_SWAR_BYTES or more gives a full one.

References mmgr_scrut_bytes_below().

Referenced by mmgr_scrut_bytes_below().

◆ mmgr_scrut_lanes_below()

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.

Parameters
[in]argsThe lane count to cover [BORROWS].
Returns
A lane mask with those lanes.
Note
mmgr_scrut_bytes_below reduced to lane bits, and so this ands cleanly against another lane mask.
And a match mask with this to retain a scan off bytes past its count.

References mmgr_scrut_lanes_below().

Referenced by mmgr_scrut_lanes_below().

◆ mmgr_scrut_lanes_before()

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.

Parameters
[in]argsThe lane mask to examine [BORROWS].
Returns
A lane mask with those lanes.
Note
An empty args->mask reports every lane, since nothing comes first.
Count the result to get the same index mmgr_scrut_lane_lo reports on a little endian target.

References mmgr_scrut_lanes_before().

Referenced by mmgr_scrut_lanes_before().

◆ mmgr_scrut_tail_mask()

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.

Parameters
[in]argsThe total byte count and the whole words already covered [BORROWS].
Returns
A lane mask over the bytes still wanted, or 0 once the walk reaches the count.
Note
A word wanted in full gets a full mask, and so this can run on every pass of a scan loop.
The only mask entry that reads args->wi.

References mmgr_scrut_tail_mask().

Referenced by mmgr_scrut_tail_mask().

◆ mmgr_scrut_run()

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.

Parameters
[in]argsThe lane mask and the run length wanted [BORROWS].
Returns
A lane mask with the lanes each run starts at.
Note
A lane that survives is where a run begins, in memory order, on either byte order.
A args->bytes of 0 or 1 returns args->mask as it is, since every set lane starts such a run.
Warning
Returns 0 for an args->bytes above MMGR_SWAR_BYTES, since no run that long fits in one word.

References mmgr_scrut_run().

Referenced by mmgr_scrut_run().

◆ mmgr_scrut_run_edge()

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.

Parameters
[in]argsThe run length wanted [BORROWS].
Returns
A lane mask with those lanes, or 0 when no lane is too near.
Note
A run of args->bytes can begin at any of the first MMGR_SWAR_BYTES minus args->bytes plus one lanes.
A caller that matches across a word boundary uses this to tell which starts need a second try.
Returns 0 for an args->bytes of 0 or 1, since any lane can start such a run, and for any length above MMGR_SWAR_BYTES, since no lane can.

References mmgr_scrut_run_edge().

Referenced by mmgr_scrut_run_edge().

◆ mmgr_scrut_load()

EMBED_HOST_DEVICE embed_word mmgr_scrut_load ( const ScrutWordCfg * args)

Loads one embed_word from args->at.

Parameters
[in]argsAddress to load from [BORROWS].
Returns
The bytes at args->at, one per lane, in the target's own order.
Warning
Reads MMGR_SWAR_BYTES bytes even for a caller that wants fewer. args->at must be readable for all of them.
Note
Any alignment will do. Use mmgr_scrut_load_al for an address that is on the alignment.

References mmgr_scrut_load().

Referenced by mmgr_scrut_load().

◆ mmgr_scrut_load_al()

EMBED_HOST_DEVICE embed_word mmgr_scrut_load_al ( const ScrutWordCfg * args)

Loads one embed_word from an aligned args->at.

Parameters
[in]argsAddress to load from [BORROWS].
Returns
The bytes at args->at, one per lane, in the target's own order.
Warning
Reads MMGR_SWAR_BYTES bytes even for a caller that wants fewer, and args->at must are on a word boundary.
Note
Use mmgr_scrut_load when the address may sit anywhere.

References mmgr_scrut_load_al().

Referenced by mmgr_scrut_load_al().

◆ mmgr_scrut_fold_lower()

EMBED_HOST_DEVICE embed_word mmgr_scrut_fold_lower ( const ScrutWordCfg * args)

Returns args->word with every character lane turned to lower case.

Parameters
[in]argsThe word to fold [BORROWS].
Returns
The word with its character lanes lowered and every other lane untouched.
Note
Only character lanes change. A digit or a symbol retains bit five exactly as it was.
Fold two words and compare them for a case insensitive test over whole words at once.

References mmgr_scrut_fold_lower().

Referenced by mmgr_scrut_fold_lower().

◆ mmgr_scrut_words()

EMBED_HOST_DEVICE size_t mmgr_scrut_words ( const ScrutWordCfg * args)

Returns how many whole words a scan of args->bytes bytes must read.

Parameters
[in]argsThe byte count to convert [BORROWS].
Returns
The count rounded up. A partial last word still counts as one.
Note
A args->bytes of 0 gives 0. A caller loops no times instead of reading one word.
Pair this with mask.tail, which supplies the lane mask for that partial last word.

References mmgr_scrut_words().

Referenced by mmgr_scrut_words().

Variable Documentation

◆ lane

const ScrutLaneNs lane
static

Dispatch table instance named lane.

Note
The first eleven members call the mmgr_scrut_ function of the same name on either byte order.
first and last bind to lane_lo and lane_hi one way round on a little endian target and the other way on a big endian one. So both always mean memory order.

Definition at line 493 of file verbum_scrutor.h.

◆ mask

const ScrutMaskNs mask
static

Dispatch table instance named mask.

Note
drop_first and drop_last bind to drop_lo and drop_hi one way round on a little endian target and the other way on a big endian one. So both always mean memory order.
before reaches mmgr_scrut_lanes_before, which carries the same swap inside itself.

Definition at line 521 of file verbum_scrutor.h.

◆ verbum

const ScrutWordNs verbum
static

Dispatch table instance named verbum, with each member set to its mmgr_scrut_ function.

Note
No member depends on byte order, unlike the lane and mask tables above.

Definition at line 543 of file verbum_scrutor.h.