sp1_core_machine/range/columns.rs
1use sp1_derive::AlignedBorrow;
2use std::mem::size_of;
3use struct_reflection::{StructReflection, StructReflectionHelper};
4
5/// The number of main trace columns for `RangeChip`.
6pub const NUM_RANGE_PREPROCESSED_COLS: usize = size_of::<RangePreprocessedCols<u8>>();
7
8/// The number of multiplicity columns for `RangeChip`.
9pub const NUM_RANGE_MULT_COLS: usize = size_of::<RangeMultCols<u8>>();
10
11/// The `RangeChip` checks that the input `(a, b)` satisfies `a < 2^b` with `b` value up to `16`.
12/// The `RangePreprocessedCols` has all the inputs that satisfy this relation.
13#[derive(Debug, Clone, Copy, AlignedBorrow, StructReflection)]
14#[repr(C)]
15pub struct RangePreprocessedCols<T> {
16 /// The value to range check.
17 pub a: T,
18
19 /// The number of bits.
20 pub bits: T,
21}
22
23/// For each range operation in the preprocessed table, a corresponding RangeMultCols row tracks
24/// the number of times the operation is used.
25#[derive(Debug, Clone, Copy, AlignedBorrow)]
26#[repr(C)]
27pub struct RangeMultCols<T> {
28 /// The multiplicity of each range operation.
29 pub multiplicity: T,
30}