diff options
author | lloyd <[email protected]> | 2008-09-07 17:58:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-07 17:58:00 +0000 |
commit | c7f8ca63b031b460ee0ae7540f1a004d98116cbf (patch) | |
tree | 3e70a71f58caa44e7d330339f405a0f14b17c765 | |
parent | b6f809b5788f27674f89e4ce89117faaf9d88c90 (diff) |
Combine redundant definitions of blocks variable
-rw-r--r-- | src/mp_monty.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mp_monty.cpp b/src/mp_monty.cpp index 90ccc648b..00e14a2b4 100644 --- a/src/mp_monty.cpp +++ b/src/mp_monty.cpp @@ -18,20 +18,20 @@ extern "C" { void bigint_monty_redc(word z[], u32bit z_size, const word x[], u32bit x_size, word u) { + const u32bit blocks_of_8 = x_size - (x_size % 8); + for(u32bit j = 0; j != x_size; ++j) { word* z_j = z + j; const word y = z_j[0] * u; - const u32bit blocks = x_size - (x_size % 8); - word carry = 0; - for(u32bit i = 0; i != blocks; i += 8) + for(u32bit i = 0; i != blocks_of_8; i += 8) carry = word8_madd3(z_j + i, x + i, y, carry); - for(u32bit i = blocks; i != x_size; ++i) + for(u32bit i = blocks_of_8; i != x_size; ++i) z_j[i] = word_madd3(x[i], y, z_j[i], &carry); word z_sum = z_j[x_size] + carry; @@ -60,12 +60,11 @@ void bigint_monty_redc(word z[], u32bit z_size, // If the compare above is true, subtract using bigint_sub2 (inlined) word carry = 0; - const u32bit blocks = x_size - (x_size % 8); - for(u32bit j = 0; j != blocks; j += 8) + for(u32bit j = 0; j != blocks_of_8; j += 8) carry = word8_sub2(z + x_size + j, x + j, carry); - for(u32bit j = blocks; j != x_size; ++j) + for(u32bit j = blocks_of_8; j != x_size; ++j) z[x_size + j] = word_sub(z[x_size + j], x[j], &carry); if(carry) |