aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp_mulop.cpp
blob: 90449d9ff6f310e022e7aa009e59b3e8deb1c6f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*************************************************
* Multiply/Add Algorithm Source File             *
* (C) 1999-2008 Jack Lloyd                       *
*************************************************/

#include <botan/mp_asm.h>
#include <botan/mp_asmi.h>
#include <botan/mp_core.h>

namespace Botan {

extern "C" {

/*************************************************
* Multiply/Add Words                             *
*************************************************/
word bigint_mul_add_words(word z[], const word x[], u32bit x_size, word y)
   {
   const u32bit blocks = x_size - (x_size % 8);

   word carry = 0;

   for(u32bit i = 0; i != blocks; i += 8)
      carry = word8_madd3(z + i, x + i, y, carry);

   for(u32bit i = blocks; i != x_size; ++i)
      z[i] = word_madd3(x[i], y, z[i], &carry);

   return carry;
   }

}

}