aztec-nr - noir_aztec::protocol::utils::arrays

Function splice_at_count

pub fn splice_at_count<T, let N: u32>(
    array1: [T; N],
    count: u32,
    array2: [T; N],
) -> [T; N]
where T: Eq

Splices two fixed-size arrays at count.

The result consists of:

  • the first count elements from array1, followed by
  • the first N - count elements from array2, producing a new array of length N.

In other words:

  • result[0..count] == array1[0..count]
  • result[count..N] == array2[0..(N - count)]

Note: This function does not consider any notion of "used length". It always copies exactly N - count elements from array2. If array2 has fewer meaningful items than that, elements from its higher indices (typically padding) will be included in the result. Callers must ensure that count correctly reflects the intended splice point and that no meaningful elements are truncated.