aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-09 22:26:34 +0000
committerlloyd <[email protected]>2008-09-09 22:26:34 +0000
commit456c1ef79167ef0cba5748842ca3748fa9ed7fc0 (patch)
tree08107571f219a5ce21c28ee884f0f5c9c348dbc6 /src
parent099ff95b4789b430fb4359acf76b7c8d6f0b5fc7 (diff)
Hoist load, since compiler may not be able to do so due to aliasing
Diffstat (limited to 'src')
-rw-r--r--src/mp_mulop.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mp_mulop.cpp b/src/mp_mulop.cpp
index 44c8757e7..cb17d5e16 100644
--- a/src/mp_mulop.cpp
+++ b/src/mp_mulop.cpp
@@ -24,13 +24,15 @@ void bigint_simple_mul(word z[], const word x[], u32bit x_size,
for(u32bit i = 0; i != y_size; ++i)
{
+ const word y_i = y[i];
+
word carry = 0;
for(u32bit j = 0; j != blocks; j += 8)
- carry = word8_madd3(z + i + j, x + j, y[i], carry);
+ carry = word8_madd3(z + i + j, x + j, y_i, carry);
for(u32bit j = blocks; j != x_size; ++j)
- z[i+j] = word_madd3(x[j], y[i], z[i+j], &carry);
+ z[i+j] = word_madd3(x[j], y_i, z[i+j], &carry);
z[x_size+i] = carry;
}
@@ -52,13 +54,14 @@ void bigint_simple_sqr(word z[], const word x[], u32bit x_size)
for(u32bit i = 0; i != x_size; ++i)
{
+ const word x_i = x[i];
word carry = 0;
for(u32bit j = 0; j != blocks; j += 8)
- carry = word8_madd3(z + i + j, x + j, x[i], carry);
+ carry = word8_madd3(z + i + j, x + j, x_i, carry);
for(u32bit j = blocks; j != x_size; ++j)
- z[i+j] = word_madd3(x[j], x[i], z[i+j], &carry);
+ z[i+j] = word_madd3(x[j], x_i, z[i+j], &carry);
z[x_size+i] = carry;
}