stwo-cairo-common 1.2.2

Common types and utilities shared across Stwo Cairo crates
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use stwo::core::fields::m31::M31;

// Pads all rows below <padding_offset> with the first row. Uses the <get_m31> function to get the
// value in a given row and column.
pub fn pad<F>(get_m31: F, padding_offset: usize, col: usize) -> Vec<M31>
where
    F: Fn(usize, usize) -> M31,
{
    let n = padding_offset.next_power_of_two();
    (0..n)
        .map(|i| if i < padding_offset { i } else { 0 })
        .map(|i| get_m31(i, col))
        .collect()
}