File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1515 deployments : write
1616 # contents permission to update benchmark contents in gh-pages branch
1717 contents : write
18+ # pull-requests permission to comment on PRs with benchmark results
1819 pull-requests : write
1920
2021 steps :
Original file line number Diff line number Diff line change @@ -63,11 +63,16 @@ impl Poseidon2 {
6363 state [RATE ] = iv ;
6464
6565 if std::runtime:: is_unconstrained () {
66- for i in 0 ..in_len {
67- state [i % RATE ] += input [i ];
68- if (i + 1 ) % RATE == 0 {
69- state = crate ::poseidon2_permutation (state , 4 );
70- }
66+ for i in 0 ..(in_len / RATE ) {
67+ state [0 ] += input [i * RATE ];
68+ state [1 ] += input [i * RATE + 1 ];
69+ state [2 ] += input [i * RATE + 2 ];
70+ state = crate ::poseidon2_permutation (state , 4 );
71+ }
72+ // handle remaining (<3) elements
73+ let remainder_start = (in_len / RATE ) * RATE ;
74+ for j in remainder_start ..in_len {
75+ state [j - remainder_start ] += input [j ];
7176 }
7277 } else {
7378 for i in 0 ..input .len () {
You can’t perform that action at this time.
0 commit comments