Skip to content

Commit cbed83e

Browse files
committed
common: small simplification
1 parent a1fe267 commit cbed83e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

crates/zk_vm/src/common.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,20 @@ use crate::{
2525
COL_INDEX_POSEIDON_24, instruction_encoder::field_representation,
2626
};
2727

28-
pub fn poseidon_16_column_groups(poseidon_16_air: &Poseidon16Air) -> Vec<Range<usize>> {
29-
vec![
30-
0..8,
31-
8..16,
32-
16..poseidon_16_air.width() - 16,
33-
poseidon_16_air.width() - 16..poseidon_16_air.width() - 8,
34-
poseidon_16_air.width() - 8..poseidon_16_air.width(),
35-
]
28+
pub fn poseidon_16_column_groups(air: &Poseidon16Air) -> Vec<Range<usize>> {
29+
let w = air.width();
30+
vec![0..8, 8..16, 16..w - 16, w - 16..w - 8, w - 8..w]
3631
}
3732

38-
pub fn poseidon_24_column_groups(poseidon_24_air: &Poseidon24Air) -> Vec<Range<usize>> {
33+
pub fn poseidon_24_column_groups(air: &Poseidon24Air) -> Vec<Range<usize>> {
34+
let w = air.width();
3935
vec![
4036
0..8,
4137
8..16,
4238
16..24,
43-
24..poseidon_24_air.width() - 24,
44-
poseidon_24_air.width() - 24..poseidon_24_air.width() - 8, // TODO should we commit to this part ? Probably not, but careful here, we will not check evaluations for this part
45-
poseidon_24_air.width() - 8..poseidon_24_air.width(),
39+
24..w - 24,
40+
w - 24..w - 8, // TODO should we commit to this part ? Probably not, but careful here, we will not check evaluations for this part
41+
w - 8..w,
4642
]
4743
}
4844

0 commit comments

Comments
 (0)