Skip to content

Commit

Permalink
Rename class_offset -> start_offset in modular_extension.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Golovanov399 committed Jan 21, 2025
1 parent 3e16275 commit 2d7adbb
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions extensions/algebra/circuit/src/modular_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<F: PrimeField32> VmExtension<F> for ModularExtension {
for (i, modulus) in self.supported_modulus.iter().enumerate() {
// determine the number of bytes needed to represent a prime field element
let bytes = modulus.bits().div_ceil(8);
let class_offset =
let start_offset =
Rv32ModularArithmeticOpcode::CLASS_OFFSET + i * Rv32ModularArithmeticOpcode::COUNT;

let config32 = ExprBuilderConfig {
Expand Down Expand Up @@ -120,28 +120,28 @@ impl<F: PrimeField32> VmExtension<F> for ModularExtension {
let addsub_chip = ModularAddSubChip::new(
adapter_chip_32.clone(),
config32.clone(),
class_offset,
start_offset,
range_checker.clone(),
offline_memory.clone(),
);
inventory.add_executor(
ModularExtensionExecutor::ModularAddSubRv32_32(addsub_chip),
addsub_opcodes
.clone()
.map(|x| VmOpcode::from_usize(x + class_offset)),
.map(|x| VmOpcode::from_usize(x + start_offset)),
)?;
let muldiv_chip = ModularMulDivChip::new(
adapter_chip_32.clone(),
config32.clone(),
class_offset,
start_offset,
range_checker.clone(),
offline_memory.clone(),
);
inventory.add_executor(
ModularExtensionExecutor::ModularMulDivRv32_32(muldiv_chip),
muldiv_opcodes
.clone()
.map(|x| VmOpcode::from_usize(x + class_offset)),
.map(|x| VmOpcode::from_usize(x + start_offset)),
)?;
let isequal_chip = ModularIsEqualChip::new(
Rv32IsEqualModAdapterChip::new(
Expand All @@ -154,42 +154,42 @@ impl<F: PrimeField32> VmExtension<F> for ModularExtension {
ModularIsEqualCoreChip::new(
modulus.clone(),
bitwise_lu_chip.clone(),
class_offset,
start_offset,
),
offline_memory.clone(),
);
inventory.add_executor(
ModularExtensionExecutor::ModularIsEqualRv32_32(isequal_chip),
iseq_opcodes
.clone()
.map(|x| VmOpcode::from_usize(x + class_offset)),
.map(|x| VmOpcode::from_usize(x + start_offset)),
)?;
} else if bytes <= 48 {
let addsub_chip = ModularAddSubChip::new(
adapter_chip_48.clone(),
config48.clone(),
class_offset,
start_offset,
range_checker.clone(),
offline_memory.clone(),
);
inventory.add_executor(
ModularExtensionExecutor::ModularAddSubRv32_48(addsub_chip),
addsub_opcodes
.clone()
.map(|x| VmOpcode::from_usize(x + class_offset)),
.map(|x| VmOpcode::from_usize(x + start_offset)),
)?;
let muldiv_chip = ModularMulDivChip::new(
adapter_chip_48.clone(),
config48.clone(),
class_offset,
start_offset,
range_checker.clone(),
offline_memory.clone(),
);
inventory.add_executor(
ModularExtensionExecutor::ModularMulDivRv32_48(muldiv_chip),
muldiv_opcodes
.clone()
.map(|x| VmOpcode::from_usize(x + class_offset)),
.map(|x| VmOpcode::from_usize(x + start_offset)),
)?;
let isequal_chip = ModularIsEqualChip::new(
Rv32IsEqualModAdapterChip::new(
Expand All @@ -202,15 +202,15 @@ impl<F: PrimeField32> VmExtension<F> for ModularExtension {
ModularIsEqualCoreChip::new(
modulus.clone(),
bitwise_lu_chip.clone(),
class_offset,
start_offset,
),
offline_memory.clone(),
);
inventory.add_executor(
ModularExtensionExecutor::ModularIsEqualRv32_48(isequal_chip),
iseq_opcodes
.clone()
.map(|x| VmOpcode::from_usize(x + class_offset)),
.map(|x| VmOpcode::from_usize(x + start_offset)),
)?;
} else {
panic!("Modulus too large");
Expand Down

0 comments on commit 2d7adbb

Please sign in to comment.