Skip to content

Commit

Permalink
Fix constraint and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
thealmarty committed Mar 18, 2024
1 parent 93d6fe5 commit e1c336b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion alu_u32/src/lt/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Lt32Cols<T> {
pub input_2: Word<T>,

/// Boolean flags indicating which byte pair differs
pub byte_flag: [T; 3],
pub byte_flag: [T; 4],

/// Bit decomposition of 256 + input_1 - input_2
pub bits: [T; 10],
Expand Down
2 changes: 1 addition & 1 deletion alu_u32/src/lt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl Lt32Chip {
for i in 0..10 {
cols.bits[i] = F::from_canonical_u16(z >> i & 1);
}
if n < 3 {
if n < 4 {
cols.byte_flag[n] = F::one();
}
}
Expand Down
7 changes: 2 additions & 5 deletions alu_u32/src/lt/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ where
.when_ne(local.bits[8], AB::Expr::one())
.assert_one(local.output);
// output should be 1 if is_lte & input_1 == input_2
let all_flag_sum = flag_sum + local.byte_flag[3];
builder
.when(local.is_lte)
.when_ne(flag_sum, AB::Expr::one())
.when_ne(
AB::Expr::from_canonical_u32(256) + local.input_1[3] - local.input_2[3],
AB::Expr::one(),
)
.when_ne(all_flag_sum, AB::Expr::one())
.assert_one(local.output);

// Check bit decomposition
Expand Down

0 comments on commit e1c336b

Please sign in to comment.