@@ -36,12 +36,12 @@ use openvm_stark_backend::{
36
36
p3_air:: { Air , AirBuilder , BaseAir } ,
37
37
p3_field:: { Field , FieldAlgebra , PrimeField32 } ,
38
38
p3_matrix:: { dense:: RowMajorMatrix , Matrix } ,
39
- p3_util:: log2_strict_usize,
40
39
prover:: types:: AirProofInput ,
41
40
rap:: { AnyRap , BaseAirWithPublicValues , PartitionedBaseAir } ,
42
41
Chip , ChipUsageGetter ,
43
42
} ;
44
43
use serde:: { Deserialize , Serialize } ;
44
+ use static_assertions:: const_assert_eq;
45
45
46
46
use crate :: adapters:: { compose, decompose} ;
47
47
@@ -89,6 +89,9 @@ impl<F: Field> BaseAir<F> for Rv32HintStoreAir {
89
89
impl < F : Field > BaseAirWithPublicValues < F > for Rv32HintStoreAir { }
90
90
impl < F : Field > PartitionedBaseAir < F > for Rv32HintStoreAir { }
91
91
92
+ const LOG2_RV32_REGISTER_NUM_LIMBS : usize = 2 ;
93
+ const_assert_eq ! ( 1 << LOG2_RV32_REGISTER_NUM_LIMBS , RV32_REGISTER_NUM_LIMBS ) ;
94
+
92
95
impl < AB : InteractionBuilder > Air < AB > for Rv32HintStoreAir {
93
96
fn eval ( & self , builder : & mut AB ) {
94
97
let main = builder. main ( ) ;
@@ -235,7 +238,7 @@ impl<AB: InteractionBuilder> Air<AB> for Rv32HintStoreAir {
235
238
. range_check :: < AB :: Expr > (
236
239
local_cols. mem_ptr_limbs [ 0 ]
237
240
* AB :: F :: from_canonical_usize ( RV32_REGISTER_NUM_LIMBS ) . inverse ( ) ,
238
- RV32_CELL_BITS - log2_strict_usize ( RV32_REGISTER_NUM_LIMBS ) ,
241
+ RV32_CELL_BITS - LOG2_RV32_REGISTER_NUM_LIMBS ,
239
242
)
240
243
. eval ( builder, is_start. clone ( ) ) ;
241
244
// We only check this on `is_start` since it is implied on non-start rows by the next_mem_ptr = mem_ptr + 4 constraint below
@@ -482,8 +485,8 @@ impl<F: PrimeField32> Rv32HintStoreChip<F> {
482
485
rem_words_msl << ( RV32_REGISTER_NUM_LIMBS * RV32_CELL_BITS - pointer_max_bits) ,
483
486
) ;
484
487
memory. range_checker ( ) . add_count (
485
- ( mem_ptr & ( ( 1 << RV32_CELL_BITS ) - 1 ) ) >> 2 ,
486
- RV32_CELL_BITS - 2 ,
488
+ ( mem_ptr & ( ( 1 << RV32_CELL_BITS ) - 1 ) ) >> LOG2_RV32_REGISTER_NUM_LIMBS ,
489
+ RV32_CELL_BITS - LOG2_RV32_REGISTER_NUM_LIMBS ,
487
490
) ;
488
491
for ( i, & ( data, write) ) in record. hints . iter ( ) . enumerate ( ) {
489
492
for half in 0 ..( RV32_REGISTER_NUM_LIMBS / 2 ) {
0 commit comments