MMgr v1.0.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 holding 1 in every lane, which is 0x0101...01.
#define MMGR_VERBUM_SCRUTOR_HIGH
 Expands to a word holding 0x80 in every lane, which is 0x8080...80.
#define MMGR_SWAR_LOW7
 Expands to a word holding 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 letter 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_word mmgr_scrut_ge (const ScrutLaneCfg *args)
 Marks the lanes of args->word that are at or above args->byte.
embed_word mmgr_scrut_le (const ScrutLaneCfg *args)
 Marks the lanes of args->word that are at or below args->byte.
embed_word mmgr_scrut_sub7 (const ScrutLaneCfg *args)
 Subtracts args->byte from every lane of args->word and keeps the low seven bits of each result.
embed_word mmgr_scrut_has_zero (const ScrutLaneCfg *args)
 Marks the lanes of args->word that hold zero.
embed_word mmgr_scrut_eq (const ScrutLaneCfg *args)
 Marks the lanes of args->word that equal args->byte.
embed_word mmgr_scrut_xor (const ScrutLaneCfg *args)
 Returns the lane by lane difference of args->word and args->val.
embed_word mmgr_scrut_fam_eq (const ScrutLaneCfg *args)
 Marks the lanes of args->word that match args->byte once both are reduced to the args->fam bits.
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_word mmgr_scrut_any_digit (const ScrutLaneCfg *args)
 Marks the lanes of args->word that fall in the 0x30 to 0x3F block.
embed_word mmgr_scrut_alpha (const ScrutLaneCfg *args)
 Marks the lanes of args->word holding an ASCII letter, of either case.
size_t mmgr_scrut_lane_count (const ScrutLaneCfg *args)
 Counts the set lanes of args->mask.
size_t mmgr_scrut_lane_lo (const ScrutLaneCfg *args)
 Returns the index of the lowest set lane of args->mask.
size_t mmgr_scrut_lane_hi (const ScrutLaneCfg *args)
 Returns the index of the highest set lane of args->mask.
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_word mmgr_scrut_drop_lo (const ScrutMaskCfg *args)
 Clears the lowest set lane of args->mask.
embed_word mmgr_scrut_drop_hi (const ScrutMaskCfg *args)
 Clears the highest set lane of args->mask.
embed_word mmgr_scrut_bytes_below (const ScrutMaskCfg *args)
 Builds a mask covering the first args->bytes bytes of a word, in memory order.
embed_word mmgr_scrut_lanes_below (const ScrutMaskCfg *args)
 Builds a lane mask covering the first args->bytes lanes of a word, in memory order.
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_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_word mmgr_scrut_run (const ScrutMaskCfg *args)
 Marks the lanes of args->mask that begin a run of args->bytes set lanes.
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_word mmgr_scrut_load (const ScrutWordCfg *args)
 Loads one embed_word from args->at.
embed_word mmgr_scrut_load_al (const ScrutWordCfg *args)
 Loads one embed_word from an aligned args->at.
embed_word mmgr_scrut_fold_lower (const ScrutWordCfg *args)
 Returns args->word with every letter lane turned to lower case.
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 word
 Dispatch table instance named word, 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 is treated as MMGR_SWAR_BYTES independent lanes. A whole word is tested at once.
A lane mask carries one set bit per matching lane, in that lane's high bit. mask.spread widens it.
The entries whose meaning depends on byte order are bound through MMGR_HW_BIG_ENDIAN in the tables below.

Definition in file verbum_scrutor.h.

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 are given is empty.

Definition at line 33 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 doubling in scrut_smear and supplies the final shift in scrut_lane_count, both of which want the whole width.

Definition at line 42 of file verbum_scrutor.h.

◆ MMGR_SWAR_ONES

#define MMGR_SWAR_ONES

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

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

Definition at line 50 of file verbum_scrutor.h.

◆ MMGR_VERBUM_SCRUTOR_HIGH

#define MMGR_VERBUM_SCRUTOR_HIGH

Expands to a word holding 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.
Or-ing it into a word before a subtraction gives each lane a borrow to spend, keeping lanes separate.

Definition at line 58 of file verbum_scrutor.h.

◆ MMGR_SWAR_LOW7

#define MMGR_SWAR_LOW7

Expands to a word holding 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 66 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 sizing suffix, and so each takes int in an expression. A scanner keeping a verdict in a uint8_t converts it on the way in.
verbum_scrutor.c reads none of the three. They are declared here for the scanners that include it.

Definition at line 77 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 80 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 83 of file verbum_scrutor.h.

◆ MMGR_FAM_CS

#define MMGR_FAM_CS

Expands to 0x60u, the two bits that separate the ASCII blocks a letter 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 90 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 97 of file verbum_scrutor.h.

Function Documentation

◆ mmgr_scrut_ge()

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 holding 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_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 holding 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_word mmgr_scrut_sub7 ( const ScrutLaneCfg * args)

Subtracts args->byte from every lane of args->word and keeps 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_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 holding 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_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 holding the matching lanes.
Note
Broadcasts args->byte itself, and so the caller passes a single byte and not a whole word.
With args->ci set, a letter matches either case. Every other byte still compares exactly.

References mmgr_scrut_eq().

Referenced by mmgr_scrut_eq().

◆ mmgr_scrut_xor()

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 is cleared on letter lanes, and so the two cases of a letter 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_word mmgr_scrut_fam_eq ( const ScrutLaneCfg * args)

Marks the lanes of args->word that match args->byte once both are reduced to the args->fam bits.

Parameters
[in]argsThe word, the byte to match, and the bits that count [BORROWS].
Returns
A lane mask holding the matching lanes.
Note
args->byte is reduced by args->fam 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_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 holding 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, and bit seven takes no part, and so 0xC0 to 0xDF is marked as well. And it with mmgr_scrut_alpha for letters alone.

References mmgr_scrut_any_upper().

Referenced by mmgr_scrut_any_upper().

◆ mmgr_scrut_any_digit()

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 holding 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_word mmgr_scrut_alpha ( const ScrutLaneCfg * args)

Marks the lanes of args->word holding an ASCII letter, of either case.

Parameters
[in]argsThe word to test [BORROWS].
Returns
A lane mask holding the letter 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()

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 are set, 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()

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 is set.
Note
The lane table reaches this as first on a little endian target and as last on a big endian one, and 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()

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 is set.
Note
The lane table reaches this as last on a little endian target and as first on a big endian one, and 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_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 holding 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 no longer a lane mask, and so do not hand it to the counting or index entries.

References mmgr_scrut_spread().

Referenced by mmgr_scrut_spread().

◆ mmgr_scrut_drop_lo()

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 stepping a mask down repeatedly ends instead of wrapping.
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_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 stepping a mask down repeatedly ends instead of wrapping.
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_word mmgr_scrut_bytes_below ( const ScrutMaskCfg * args)

Builds a mask covering 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_word mmgr_scrut_lanes_below ( const ScrutMaskCfg * args)

Builds a lane mask covering the first args->bytes lanes of a word, in memory order.

Parameters
[in]argsThe lane count to cover [BORROWS].
Returns
A lane mask holding 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 keep a scan from acting on bytes past its count.

References mmgr_scrut_lanes_below().

Referenced by mmgr_scrut_lanes_below().

◆ mmgr_scrut_lanes_before()

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 holding 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_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 count is reached.
Note
A word wanted in full gets a full mask, and so this can be applied 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_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 holding the lanes each run starts at.
Note
A surviving lane is where a run begins, in memory order, on either byte order.
A args->bytes of 0 or 1 returns args->mask as it stands, 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_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 holding 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 matching across a word boundary uses this to tell which starts must be tried again.
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_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 when fewer are wanted. args->at must be readable for all of them.
Note
Any alignment will do. Use mmgr_scrut_load_al when the address is known to be aligned.

References mmgr_scrut_load().

Referenced by mmgr_scrut_load().

◆ mmgr_scrut_load_al()

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 when fewer are wanted, and args->at must be aligned for a word.
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_word mmgr_scrut_fold_lower ( const ScrutWordCfg * args)

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

Parameters
[in]argsThe word to fold [BORROWS].
Returns
The word with its letter lanes lowered and every other lane untouched.
Note
Only letter lanes are changed. A digit or a symbol keeps 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()

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 matching mmgr_scrut_ function on either byte order.
first and last are bound to lane_lo and lane_hi one way round on a little endian target and the other way on a big endian one, and so both always mean memory order.

Definition at line 490 of file verbum_scrutor.h.

◆ mask

const ScrutMaskNs mask
static

Dispatch table instance named mask.

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

Definition at line 518 of file verbum_scrutor.h.

◆ word

const ScrutWordNs word
static

Dispatch table instance named word, 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 540 of file verbum_scrutor.h.