aboutsummaryrefslogtreecommitdiffstats
path: root/include/mp_asm.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-06 14:45:05 +0000
committerlloyd <[email protected]>2006-06-06 14:45:05 +0000
commitd3522b3622ac4aad18215bc173f9e26953c6cc3d (patch)
tree9e5a9e947fc57b83700877a1261b307030ae09ff /include/mp_asm.h
parent71ef9df15a45af4d49070336a2dfc0a703a3c21e (diff)
Remove one parameter from word_madd2 and word_madd3
Diffstat (limited to 'include/mp_asm.h')
-rw-r--r--include/mp_asm.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/mp_asm.h b/include/mp_asm.h
index 5f0747d88..1166d9c8d 100644
--- a/include/mp_asm.h
+++ b/include/mp_asm.h
@@ -27,20 +27,20 @@ extern "C" {
/*************************************************
* Word Multiply/Add *
*************************************************/
-inline word word_madd2(word a, word b, word c, word* carry)
+inline word word_madd2(word a, word b, word* c)
{
- dword z = (dword)a * b + c;
- *carry = (word)(z >> BOTAN_MP_WORD_BITS);
+ dword z = (dword)a * b + *c;
+ *c = (word)(z >> BOTAN_MP_WORD_BITS);
return (word)z;
}
/*************************************************
* Word Multiply/Add *
*************************************************/
-inline word word_madd3(word a, word b, word c, word d, word* carry)
+inline word word_madd3(word a, word b, word c, word *d)
{
- dword z = (dword)a * b + c + d;
- *carry = (word)(z >> BOTAN_MP_WORD_BITS);
+ dword z = (dword)a * b + c + *d;
+ *d = (word)(z >> BOTAN_MP_WORD_BITS);
return (word)z;
}
@@ -49,7 +49,11 @@ inline word word_madd3(word a, word b, word c, word d, word* carry)
*************************************************/
inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b)
{
- *w0 = word_madd2(a, b, *w0, &b);
+ dword z = (dword)a * b + *w0;
+
+ b = (word)(z >> BOTAN_MP_WORD_BITS);
+ *w0 = (word)z;
+
*w1 += b;
*w2 += (*w1 < b) ? 1 : 0;
}
@@ -59,7 +63,10 @@ inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b)
*************************************************/
inline void word3_muladd_2(word* w2, word* w1, word* w0, word a, word b)
{
- a = word_madd2(a, b, 0, &b);
+ dword z = (dword)a * b;
+
+ b = (word)(z >> BOTAN_MP_WORD_BITS);
+ a = (word)z;
*w0 += a;
*w1 += b + ((*w0 < a) ? 1 : 0);