//! Tip5 โ Apple-Silicon-tuned, bit-identical to `twenty_first::Tip5` v1.1.0.
//!
//! State is `[u64; 16]` of raw-Montgomery `BFieldElement` words. Public API
//! deals only in raw u64s; converting to/from `BFieldElement::value()`
//! (canonical) is the caller's responsibility โ for a downstream consumer
//! that owns `BFieldElement` values, `raw_u64()` / `from_raw_u64(_)` are the
//! free bridges.
//!
//! ## Domains and digest convention
//!
//! - `tip5_hash_pair([u64; 5], [u64; 5])` matches `Tip5::hash_pair`. Inputs
//! are the raw-Montgomery `Digest::values()` of `left` then `right`. The
//! sponge initializes in `FixedLength` domain (state[10..16] = mont(1)).
//! The first 5 raw words of the post-permutation state are returned.
//! - `tip5_hash_varlen(&[u64])` matches `Tip5::hash_varlen`. Inputs are raw
//! Montgomery elements; padding is `[1, 0, 0, โฆ]` (one canonical `mont(1)`
//! followed by zeros). The capacity is initialized to all zeros
//! (`VariableLength` domain).
//!
//! ## Speed model
//!
//! Tip5 cost is dominated by the MDS layer (8 round-trips through the
//! `mds_generated` matrix per permutation) and the per-state xโท S-box
//! (4 montgomery multiplies ร 12 lanes ร 5 rounds = 240 muls). On the M4
//! P-core both are heavily ILP-friendly; this implementation interleaves 12
//! independent multiply chains for the S-box and uses straight-line
//! `wrapping_*` code for the MDS, which LLVM schedules tightly.
pub use ;
pub use tip5_permute_sme;
use mds_generated_inplace;
use pow7_last12;
use ;
// โโ domain constants โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/// Sponge state width.
pub const STATE_SIZE: usize = 16;
/// Sponge rate (how many lanes the caller can read/write).
pub const RATE: usize = 10;
/// Number of S-box lanes that use the 256-byte split-and-lookup table.
pub const NUM_SPLIT_AND_LOOKUP: usize = 4;
/// Digest size in BFieldElements.
pub const DIGEST_LEN: usize = 5;
/// Number of Tip5 rounds.
pub const NUM_ROUNDS: usize = 5;
/// R = 2^64 mod P. Equals `montyred(R^2)` and is `BFieldElement::ONE.raw_u64()`.
pub const RAW_MONT_ONE: u64 = ;
// โโ public API โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/// Apply the Tip5 permutation in place to a 16-lane raw-Montgomery state.
///
/// Bit-identical to one invocation of `Tip5::permutation` on a `Tip5` whose
/// `state[i].raw_u64() == s[i]`.
/// Hash a pair of digests. Bit-identical to `Tip5::hash_pair` once inputs
/// are passed as raw `Digest::values()` words.
/// Hash a variable-length sequence of raw-Montgomery BFieldElements.
///
/// Bit-identical to `Tip5::hash_varlen` once each `input[i]` is `e.raw_u64()`.
/// Batched permutation โ `N` independent Tip5 states permuted in one call.
///
/// Each state is processed independently. Provides a target for callers that
/// can amortize call overhead and that LLVM can schedule with cross-state
/// ILP. Bit-identical to `N` separate `tip5_permute` calls.
/// Sequential batch hash_pair over a slice of `(left, right)` digest pairs.
///
/// Bit-identical to calling [`tip5_hash_pair`] in a loop; exists as the API
/// shape that the parallel version partitions over.
/// Multi-threaded `hash_pair` over a slice of pairs โ the Merkle-layer fast
/// path. Partitions the work across P-cores via `std::thread::scope` (not
/// rayon โ keeps the honeycrisp zero-copy mandate intact) and pins each
/// worker via [`crate::sync::affinity::pin_p_core`]. Workers process their
/// slice with the scalar [`tip5_hash_pair`] path.
///
/// Throughput scaling on M4 Max (12 P-cores, single-thread baseline ~4 M
/// hashes/s):
///
/// n= 1024 : ~1ร (spawn cost dominates)
/// n= 4096 : ~3.3ร (โ13 M hashes/s)
/// n= 65536 : ~4.3ร (โ17 M hashes/s) โ best amortization
///
/// Falls below theoretical 12ร because:
/// 1. macOS QoS class is a soft pin, not hard affinity.
/// 2. Shared `LOOKUP_TABLE` / `ROUND_CONSTANTS_RAW` cause memory contention.
/// 3. Thermal throttling on sustained 12-core load.
///
/// `n_threads = 0` selects all available P-cores.
// โโ internals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/// Tip5 S-box layer:
/// - lanes 0..4 : split_and_lookup (256-byte table on each of 8 bytes)
/// - lanes 4..16 : xโท
// Keep `P` and `montyred` reachable for tests in this module.
const _P: u64 = P;
const
Homonyms
cyb/evy/forks/naga/src/back/hlsl/mod.rs
struct Baz { m: mat3x2, } struct Baz { float2 m_0; float2 m_1; float2 m_2; }; float3x2 GetMatmOnBaz(Baz obj) { return float3x2(obj.m_0, obj.m_1, obj.m_2); }