diff options
author | lloyd <[email protected]> | 2006-06-08 04:54:04 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-08 04:54:04 +0000 |
commit | c9a2d46d4a67168c8aece9e2f5a45454fe68ede9 (patch) | |
tree | cfdefcfb93a18018665e0942caaec6182f7add66 /include/mp_asmi.h | |
parent | d2cfbe00f3c5291f7eaf971cf19aa3266431c0af (diff) |
Move the word3_muladd routines from mp_asm.h to mp_asmi.h, so they
can make use of word_add
Update mp_comba.cpp to include the needed header.
Diffstat (limited to 'include/mp_asmi.h')
-rw-r--r-- | include/mp_asmi.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/mp_asmi.h b/include/mp_asmi.h index b05199d0a..46a0696de 100644 --- a/include/mp_asmi.h +++ b/include/mp_asmi.h @@ -150,6 +150,34 @@ inline word word8_madd3(word z[8], const word x[8], word y, word carry) return carry; } +/************************************************* +* Multiply-Add Accumulator * +*************************************************/ +inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b) + { + *w0 = word_madd2(a, b, *w0, &b); + *w1 += b; + *w2 += (*w1 < b) ? 1 : 0; + } + +/************************************************* +* Multiply-Add Accumulator * +*************************************************/ +inline void word3_muladd_2(word* w2, word* w1, word* w0, word a, word b) + { + a = word_madd2(a, b, 0, &b); + + word top = (b >> (BOTAN_MP_WORD_BITS-1)); + b <<= 1; + b |= (a >> (BOTAN_MP_WORD_BITS-1)); + a <<= 1; + + word carry = 0; + *w0 = word_add(*w0, a, &carry); + *w1 = word_add(*w1, b, &carry); + *w2 = word_add(*w2, top, &carry); + } + } } |