pub fn field_to_limbs<F: PrimeField>(f: &F) -> [u64; 4]Expand description
Returns the four LE u64 Montgomery-form limbs underlying f.
ark-ff 0.5 defines Fp<P, 4>(pub BigInt<4>, pub PhantomData<P>) and
BigInt<4>(pub [u64; 4]). Rust’s default layout for a struct with one
non-ZST field lays those out identically to [u64; 4], and the
.0.0 path exposes the Montgomery limbs directly. PrimeField
doesn’t expose that path generically, so we do the reinterpretation
via raw-pointer read after asserting the size and alignment invariants
the cache relies on everywhere.
Reading Montgomery limbs is crucial for zero-copy: the on-disk bytes
stored by write_field_slice must match Fp’s in-memory layout
exactly so mmap_field_vec_unchecked can reinterpret the mapped bytes
directly. If we stored the canonical form (via into_bigint) the
mmap-backed Vec would contain values that look like canonical but
the prover would treat as Montgomery — silent corruption.