aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp_monty.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-17 12:29:40 +0000
committerlloyd <[email protected]>2006-08-17 12:29:40 +0000
commita8f1ddef2fec0a472b026ddef244736424a96e74 (patch)
tree86fb40e76145f3a9aea58998e3a7119fc2bced01 /src/mp_monty.cpp
parent2476fc2f236c07eeb89750a9776ef6c155fff862 (diff)
Inline the call to word_add in bigint_monty_redc - the carry in was
always zero, so this is both a bit more efficient and more readable. It won't be able to take advantage of asm implementations of word_add, but the benefit from that with a single call per loop is small anyway.
Diffstat (limited to 'src/mp_monty.cpp')
-rw-r--r--src/mp_monty.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mp_monty.cpp b/src/mp_monty.cpp
index 03f6f966b..3347cfa4f 100644
--- a/src/mp_monty.cpp
+++ b/src/mp_monty.cpp
@@ -32,9 +32,9 @@ void bigint_monty_redc(word z[], u32bit z_size,
for(u32bit k = blocks; k != x_size; ++k)
z_j[k] = word_madd3(x[k], y, z_j[k], carry, &carry);
- word carry2 = 0;
- z_j[x_size] = word_add(z_j[x_size], carry, &carry2);
- carry = carry2;
+ word z_sum = z_j[x_size] + carry;
+ carry = (z_sum < z_j[x_size]);
+ z_j[x_size] = z_sum;
for(u32bit k = x_size + 1; carry && k != z_size - j; ++k)
{