Annotate noexcept and constexpr with HEDLEY, and add interval containment, ChaCha, and the dyadic range tables.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ryan Henry 2026-09-24 20:44:07 -06:00
parent 875f09fec1
commit 0d8a5a8131
97 changed files with 9212 additions and 1159 deletions

View file

@ -34,6 +34,7 @@ namespace detail
template <unsigned Bits>
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
unsigned lane_at(unsigned byte, unsigned shift) noexcept
{
constexpr unsigned mask = (1u << Bits) - 1u;
@ -67,6 +68,7 @@ NodeT apply_bytes(const NodeT & a, const NodeT & b, Op op) noexcept
return out;
}
HEDLEY_NO_THROW
inline simde__m128i nibble_lut(const unsigned char lut[16]) noexcept
{
simde__m128i table;
@ -74,6 +76,7 @@ inline simde__m128i nibble_lut(const unsigned char lut[16]) noexcept
return table;
}
HEDLEY_NO_THROW
inline simde__m256i nibble_lut256(const unsigned char lut[16]) noexcept
{
alignas(32) unsigned char both[32];
@ -84,6 +87,7 @@ inline simde__m256i nibble_lut256(const unsigned char lut[16]) noexcept
return table;
}
HEDLEY_NO_THROW
inline void fill_epi2_mul_lut(unsigned k, unsigned char lut[16]) noexcept
{
k &= 3u;
@ -95,6 +99,7 @@ inline void fill_epi2_mul_lut(unsigned k, unsigned char lut[16]) noexcept
}
}
HEDLEY_NO_THROW
inline void fill_epi4_mul_lut(unsigned k, unsigned char lut[16]) noexcept
{
k &= 0x0fu;
@ -104,6 +109,7 @@ inline void fill_epi4_mul_lut(unsigned k, unsigned char lut[16]) noexcept
}
}
HEDLEY_NO_THROW
inline simde__m128i shuffle_nibbles(simde__m128i table, simde__m128i a) noexcept
{
const auto m = simde_mm_set1_epi8(0x0f);
@ -114,6 +120,7 @@ inline simde__m128i shuffle_nibbles(simde__m128i table, simde__m128i a) noexcept
simde_mm_slli_epi16(simde_mm_and_si128(hi, m), 4));
}
HEDLEY_NO_THROW
inline simde__m256i shuffle_nibbles(simde__m256i table, simde__m256i a) noexcept
{
const auto m = simde_mm256_set1_epi8(0x0f);
@ -126,6 +133,7 @@ inline simde__m256i shuffle_nibbles(simde__m256i table, simde__m256i a) noexcept
/// Low nibble of every byte, product mod 16. Even and odd bytes are split
/// so a product in one byte cannot land in the next.
HEDLEY_NO_THROW
inline simde__m128i mul_low_nibbles(simde__m128i a, simde__m128i b) noexcept
{
const auto lane = simde_mm_set1_epi16(0x000f);
@ -138,6 +146,7 @@ inline simde__m128i mul_low_nibbles(simde__m128i a, simde__m128i b) noexcept
return simde_mm_or_si128(pe, simde_mm_slli_epi16(po, 8));
}
HEDLEY_NO_THROW
inline simde__m256i mul_low_nibbles(simde__m256i a, simde__m256i b) noexcept
{
const auto lane = simde_mm256_set1_epi16(0x000f);