Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hoist constraints on inputs to top of program #4076

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Ssa {
// We iterate through the previous instructions in reverse order so the index is from the
// back of the vector. Subtract from vector length to get correct index.
.map(|reversed_index| filtered_instructions.len() - reversed_index)
.unwrap_or(filtered_instructions.len());
.unwrap_or(0);

filtered_instructions.insert(index, instruction);
}
Expand Down
2 changes: 2 additions & 0 deletions test_programs/execution_success/bit_and/Prover.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
x = "0x00"
y = "0x10"
a = "0x00"
b = "0x10"
8 changes: 4 additions & 4 deletions test_programs/execution_success/bit_and/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// You can only do bit operations with integers.
// (Kobi/Daira/Circom/#37) https://github.com/iden3/circom/issues/37
fn main(x: Field, y: Field) {
fn main(x: Field, y: Field, a: Field, b: Field) {
let x_as_u8 = x as u8;
let y_as_u8 = y as u8;

Expand All @@ -9,8 +9,8 @@ fn main(x: Field, y: Field) {
let flag = (x == 0) & (y == 16);
assert(flag);
//bitwise and with odd bits:
let x_as_u11 = x as u11;
let y_as_u11 = y as u11;
assert((x_as_u11 & y_as_u11) == x_as_u11);
let a_as_u8 = a as u8;
let b_as_u8 = b as u8;
assert((a_as_u8 & b_as_u8) == a_as_u8);
}

Loading