-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update comment about why both file lock and mutex are needed.
- Loading branch information
Showing
4 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
test_programs/execution_success/brillig_loop_unroll/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "brillig_loop_unroll" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
1 change: 1 addition & 0 deletions
1
test_programs/execution_success/brillig_loop_unroll/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sum = "6" |
23 changes: 23 additions & 0 deletions
23
test_programs/execution_success/brillig_loop_unroll/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
fn main(sum: u32) { | ||
assert(loop(0, 4) == sum); | ||
} | ||
|
||
fn loop(from: u32, to: u32) -> u32 { | ||
let mut sum = 0; | ||
for i in from..to { | ||
sum = sum + i; | ||
} | ||
sum | ||
} | ||
|
||
// fn plain_loop() -> u32 { | ||
// let mut sum = 0; | ||
// let mut arr = &[]; | ||
// sum = sum + 0; | ||
// arr.push_back(sum); | ||
// sum = sum + 1; | ||
// arr.push_back(sum); | ||
// sum = sum + 2; | ||
// arr.push_back(sum); | ||
// sum | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters