Skip to content

Commit

Permalink
Packed Big Uint Struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Gali-StarkWare committed Feb 6, 2025
1 parent cb1ef05 commit b9f689b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion stwo_cairo_prover/crates/prover_types/src/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use stwo_prover::core::backend::simd::m31::PackedM31;
use stwo_prover::core::fields::FieldExpOps;

use super::cpu::{UInt16, UInt32, UInt64, PRIME};
use crate::cpu::{CasmState, Felt252};
use crate::cpu::{BigUInt, CasmState, Felt252};

pub const LOG_N_LANES: u32 = 4;

Expand Down Expand Up @@ -446,6 +446,23 @@ impl DivExtend for PackedM31 {
}
}

// TODO(Gali): Change to an efficient implementation.
#[derive(Copy, Clone, Debug)]
pub struct PackedBigUInt<const B: usize, const L: usize, const F: usize> {
value: [BigUInt<B, L, F>; N_LANES],
}
impl<const B: usize, const L: usize, const F: usize> PackedBigUInt<B, L, F> {
pub fn to_array(&self) -> [BigUInt<B, L, F>; N_LANES] {
self.value
}

pub fn broadcast(value: BigUInt<B, L, F>) -> Self {
Self {
value: [value; N_LANES],
}
}
}

#[derive(Copy, Clone, Debug)]
pub struct PackedCasmState {
pub pc: PackedM31,
Expand Down

0 comments on commit b9f689b

Please sign in to comment.