diff options
author | Jack Lloyd <[email protected]> | 2018-03-04 05:51:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-04 05:51:38 -0500 |
commit | 9d552010688623e185e4ae15cd045b6c79b17cb7 (patch) | |
tree | 9a89d482e503bf249c23a0b3255490b2de3f1a0e /src/lib/math/mp | |
parent | 36451c67afd87876ab0b180c4f3f93a8dec5f9c8 (diff) |
Simplify indexing in this loop
Diffstat (limited to 'src/lib/math/mp')
-rw-r--r-- | src/lib/math/mp/mp_monty.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/math/mp/mp_monty.cpp b/src/lib/math/mp/mp_monty.cpp index ea32313d0..199475297 100644 --- a/src/lib/math/mp/mp_monty.cpp +++ b/src/lib/math/mp/mp_monty.cpp @@ -70,16 +70,16 @@ void bigint_monty_redc(word z[], w2 = 0; } - for(size_t i = p_size; i != 2*p_size; ++i) + for(size_t i = 0; i != p_size; ++i) { - for(size_t j = i - p_size + 1; j != p_size; ++j) + for(size_t j = i + 1; j != p_size; ++j) { - word3_muladd(&w2, &w1, &w0, ws[j], p[i-j]); + word3_muladd(&w2, &w1, &w0, ws[j], p[p_size + i-j]); } - word3_add(&w2, &w1, &w0, z[i]); + word3_add(&w2, &w1, &w0, z[p_size+i]); - ws[i-p_size] = w0; + ws[i] = w0; w0 = w1; w1 = w2; w2 = 0; |