Expand description
Fixed-width wrapping integers — the ring ℤ/2ᵏℤ.
Unlike crate::numeric::BigInt, whose arithmetic is exact and unbounded, a Word
is total and wrapping: Word32::MAX.add(Word32::ONE) == Word32::ZERO. This is the
natural home for the bit-twiddling primitives — ChaCha20 lives over Word32, Keccak
over Word64 — where each operation is a single native instruction and the modular
semantics are exact rather than an overflow into arbitrary precision. Rotation
(rotl/rotr) is width-defined and lives only here.
Structs§
- Lanes4
Word32 - Four lanes of
Word32= one 128-bit register (__m128i) — the SHA-1 state/message carrier. Unlike the arithmetic lane types, its vocabulary is the four Intel SHA operations (sha1rnds4/sha1msg1/sha1msg2/sha1nexte), so SHA-1 WRITTEN in Logos over these compiles to thesha1rnds4hardware sequence (AOT) and runs the byte-identical software speccrate::sha_opson the interpreter. Laneiis bits[32i+31 : 32i]— index 0 low, index 3 high — matching_mm_loadu_si128. - Lanes4
Word64 - Four lanes of
Word64(one 256-bit SIMD register) — the Poly1305 accumulator lane vector. Carries[u64; 4]; ops have an AVX2 fast path proven byte-identical to the scalar lanes. - Lanes8
Word32 - Eight lanes of
Word32(one 256-bit SIMD register). Operations are lane-wise over the ℤ/2³² ring. - Lanes16
Word8 - Sixteen
Word8lanes = one 128-bit register (__m128i) — the BYTE-SHUFFLE carrier for SIMD text codecs (hex encode/decode). Its vocabulary isshuffle(pshufb, a 16-entry byte LUT), byte AND, per-byte shift, and the two byte interleaves — so a hex codec WRITTEN in Logos over it compiles to thepshufbsequence (AOT, when SSSE3 is statically enabled) and runs the byte-identical scalar spec on the interpreter. Laneiis bytei(index 0 low), matching_mm_loadu_si128. - Lanes16
Word16 - Sixteen lanes of
Word16(one 256-bit SIMD register) — the NTT coefficient lane vector. Carries[u16; 16]; the multiply-high is the SIGNED_mm256_mulhi_epi16(the Montgomery butterfly’smulhi). Ops have an AVX2 fast path proven byte-identical to the scalar lanes. - Word8
- A 8-bit wrapping integer: the ring ℤ/2^8ℤ, where every operation is total and wraps modulo 2^8.
- Word16
- A 16-bit wrapping integer: the ring ℤ/2^16ℤ, where every operation is total and wraps modulo 2^16.
- Word32
- A 32-bit wrapping integer: the ring ℤ/2^32ℤ, where every operation is total and wraps modulo 2^32.
- Word64
- A 64-bit wrapping integer: the ring ℤ/2^64ℤ, where every operation is total and wraps modulo 2^64.
Enums§
- Lanes
Val - A SIMD lane vector of any supported lane config — the single runtime carrier the interpreter/VM
match on, mirroring
WordVal. Binary ops require the same config; a mismatch returnsNone. - WordVal
- A fixed-width wrapping integer of either supported width — the single runtime carrier for
Word32/Word64across the interpreter, VM, and wire, so the rest of the system matches on oneWordvalue rather than a variant per width. Binary ops require matching widths; a width mismatch is a type error the caller reports (the ops returnNone).