fix reverse loop have to add range, which is always 1 for now

This commit is contained in:
gluaxspeed 2021-07-26 17:22:05 -07:00
parent a73bc73750
commit 3f890c9f30
3 changed files with 6 additions and 5 deletions

View File

@ -57,7 +57,8 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
(true, true) => Box::new(from..=to),
(true, false) => Box::new(from..to),
(false, true) => Box::new((to..=from).rev()),
(false, false) => Box::new((to..from).rev()),
// add the range to the values to get correct bound
(false, false) => Box::new(((to + 1)..(from + 1)).rev()),
};
for i in iter {

View File

@ -6,7 +6,7 @@ input_file: inputs/dummy.in
function main(k: bool) -> bool {
let reverse: u32 = 0;
for i in 10..0 {
for i in 9..0 {
reverse += i;
}

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 7ecd56e44c6b1cb4f702a2712a2a7fe3bf564dac26a70e1f14151a688fb24769
canonicalized_ast: 360ecac21f95b0e1d949d49458f2c4557446d01db08333d6f25621ef47a78a66
type_inferenced_ast: 853fdefe080011aaa35363e827a527ab7ce6c7e93cd568c8a150211fa6e402fe
initial_ast: 280277fb32e4eece0eab1f72338a9b60b6792d7f11124e8c4a5678ef3fc4a04e
canonicalized_ast: 84769d3580d79825fef6fd00dd9ab88dc6eaf16bf2e3f3c46feae654f8f1f746
type_inferenced_ast: 078070bc5df73c49f8de0ca37ac624c93a67551e0221dc1c65a84588507a2a6f