Skip to content

Commit

Permalink
Change add_input() Signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Gali-StarkWare committed Jan 23, 2025
1 parent 5c5e661 commit 9eb3d89
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions stwo_cairo_prover/crates/prover/src/cairo_air/air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ impl CairoClaimGenerator {
.map(M31::from_u32_unchecked)
{
let id = memory_address_to_id_trace_generator.get_id(addr);
memory_address_to_id_trace_generator.add_input(addr);
memory_id_to_value_trace_generator.add_input(id);
memory_address_to_id_trace_generator.add_input(&addr);
memory_id_to_value_trace_generator.add_input(&id);
}

// Public data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ impl ClaimGenerator {

pub fn add_inputs(&self, inputs: &[InputType]) {
for input in inputs {
self.add_input(*input);
self.add_input(input);
}
}

pub fn add_packed_m31(&self, inputs: &PackedBaseField) {
let addresses = inputs.to_array();
for address in addresses {
self.add_input(address);
self.add_input(&address);
}
}

pub fn add_input(&self, addr: BaseField) {
pub fn add_input(&self, addr: &BaseField) {
self.multiplicities.increase_at(addr.0);
}

Expand Down Expand Up @@ -199,7 +199,7 @@ mod tests {
let expected_mults = [1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].map(M31);

address_usages.iter().for_each(|addr| {
memory_address_to_id_gen.add_input(*addr);
memory_address_to_id_gen.add_input(addr);
});
let actual_mults = memory_address_to_id_gen.multiplicities.into_simd_vec();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ impl ClaimGenerator {

pub fn add_inputs(&self, inputs: &[InputType]) {
for &input in inputs {
self.add_input(input);
self.add_input(&input);
}
}

pub fn add_packed_m31(&self, inputs: &PackedM31) {
let memory_ids = inputs.to_array();
for memory_id in memory_ids {
self.add_input(memory_id);
self.add_input(&memory_id);
}
}

pub fn add_input(&self, M31(encoded_memory_id): M31) {
match EncodedMemoryValueId(encoded_memory_id).decode() {
pub fn add_input(&self, encoded_memory_id: &M31) {
match EncodedMemoryValueId(encoded_memory_id.0).decode() {
MemoryValueId::F252(id) => {
self.big_mults.increase_at(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ macro_rules! range_check_prover {

pub fn add_inputs(&self, inputs: &[[M31; N_RANGES]]) {
for input in inputs {
self.add_input(*input);
self.add_input(input);
}
}

// TODO(Ohad): test.
pub fn add_input(&self, input: InputType) {
pub fn add_input(&self, input: &InputType) {
let mut value = 0_u32;
for (segment, segment_n_bits) in zip(input, RANGES) {
value <<= segment_n_bits;
Expand All @@ -64,7 +64,7 @@ macro_rules! range_check_prover {
pub fn add_packed_m31(&self, input: &PackedInputType) {
let arrays: [_; N_RANGES] = std::array::from_fn(|i| input[i].to_array());
for i in 0..N_LANES {
self.add_input(std::array::from_fn(|j| arrays[j][i]));
self.add_input(&std::array::from_fn(|j| arrays[j][i]));
}
}

Expand Down

0 comments on commit 9eb3d89

Please sign in to comment.