REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
simd.hpp File Reference

A uniform 16-lane mask interface over two ISAs (NEON, SSE2), so the decision/loop logic that consumes it (pike.hpp) is written ONCE, with no #if ISA branch of its own. More...

#include "real/version.hpp"
#include <bit>
#include <cstddef>
#include <cstdint>
#include <cstring>
Include dependency graph for simd.hpp:

Namespaces

namespace  real
 REAL's public API: real::regex, real::static_regex, real::flags and the match/iterator types built on them.
 
namespace  real::detail
 DFA construction internals: subset construction over a flattened NFA. Not a stable API.
 

Detailed Description

A uniform 16-lane mask interface over two ISAs (NEON, SSE2), so the decision/loop logic that consumes it (pike.hpp) is written ONCE, with no #if ISA branch of its own.

mask_t is opaque and per-ISA (a nibble-packed std::uint64_t on NEON, a bit-packed std::uint32_t on SSE2) — the loop that drives it never touches the raw bits, only the primitives below, so nothing in pike.hpp needs to know which packing is behind a given build. Two "load" entry points build a mask from 16 already-loaded bytes (a small first-byte set, or a homogeneous <= 2-range class); the rest — empty, first_lane, clear_first, window_all_set, first_clear_lane, next_set_lane — are what a block-scan-then-verify loop needs and nothing more.

Every function here is either intrinsics-only or a few bit ops over an opaque scalar — no eligibility decision, no candidate/skip loop, no memcpy of the SUBJECT text (the caller owns that, MISRA-clean). That split keeps the loop logic in pike.hpp the same C++ on every ISA, exercised by the ordinary test suite whichever leg compiled. The primitives here are ISA-exclusive by construction — the NEON body never compiles on x86, nor SSE2 on aarch64 — so no single runner can line-cover both; hence this file's COV_FLOOR_IGNORE in the Makefile, the contract being guarded instead by sanitize, the fuzz corpus and the twin ISA's own runs over the identical interface.