9 #include <botan/internal/mp_asm.h>
10 #include <botan/internal/mp_asmi.h>
11 #include <botan/internal/mp_core.h>
12 #include <botan/exceptn.h>
13 #include <botan/mem_ops.h>
26 const size_t blocks = y_size - (y_size % 8);
28 for(
size_t i = 0; i != blocks; i += 8)
31 for(
size_t i = blocks; i != y_size; ++i)
34 for(
size_t i = y_size; i != x_size; ++i)
44 const word y[],
size_t y_size)
51 const size_t blocks = y_size - (y_size % 8);
53 for(
size_t i = 0; i != blocks; i += 8)
54 carry =
word8_add3(z + i, x + i, y + i, carry);
56 for(
size_t i = blocks; i != y_size; ++i)
59 for(
size_t i = y_size; i != x_size; ++i)
68 void bigint_add2(word x[],
size_t x_size,
const word y[],
size_t y_size)
78 const word y[],
size_t y_size)
80 z[(x_size > y_size ? x_size : y_size)] +=
87 word
bigint_sub2(word x[],
size_t x_size,
const word y[],
size_t y_size)
91 const size_t blocks = y_size - (y_size % 8);
93 for(
size_t i = 0; i != blocks; i += 8)
96 for(
size_t i = blocks; i != y_size; ++i)
97 x[i] =
word_sub(x[i], y[i], &borrow);
99 for(
size_t i = y_size; i != x_size; ++i)
112 const size_t blocks = y_size - (y_size % 8);
114 for(
size_t i = 0; i != blocks; i += 8)
117 for(
size_t i = blocks; i != y_size; ++i)
118 x[i] =
word_sub(y[i], x[i], &borrow);
128 const word y[],
size_t y_size)
132 const size_t blocks = y_size - (y_size % 8);
134 for(
size_t i = 0; i != blocks; i += 8)
135 borrow =
word8_sub3(z + i, x + i, y + i, borrow);
137 for(
size_t i = blocks; i != y_size; ++i)
138 z[i] =
word_sub(x[i], y[i], &borrow);
140 for(
size_t i = y_size; i != x_size; ++i)
151 const size_t blocks = x_size - (x_size % 8);
155 for(
size_t i = 0; i != blocks; i += 8)
158 for(
size_t i = blocks; i != x_size; ++i)
169 const size_t blocks = x_size - (x_size % 8);
173 for(
size_t i = 0; i != blocks; i += 8)
176 for(
size_t i = blocks; i != x_size; ++i)
void bigint_sub2_rev(word x[], const word y[], size_t y_size)
word word8_sub2_rev(word x[8], const word y[8], word carry)
word word8_add2(word x[8], const word y[8], word carry)
word word8_linmul3(word z[8], const word x[8], word y, word carry)
word bigint_sub2(word x[], size_t x_size, const word y[], size_t y_size)
void bigint_linmul2(word x[], size_t x_size, word y)
word bigint_add3_nc(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
word word8_sub2(word x[8], const word y[8], word carry)
word bigint_sub3(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
word word_madd2(word a, word b, word *c)
void bigint_linmul3(word z[], const word x[], size_t x_size, word y)
word word8_linmul2(word x[8], word y, word carry)
word bigint_add2_nc(word x[], size_t x_size, const word y[], size_t y_size)
word word8_add3(word z[8], const word x[8], const word y[8], word carry)
word word_sub(word x, word y, word *carry)
void bigint_add2(word x[], size_t x_size, const word y[], size_t y_size)
word word_add(word x, word y, word *carry)
word word8_sub3(word z[8], const word x[8], const word y[8], word carry)
void bigint_add3(word z[], const word x[], size_t x_size, const word y[], size_t y_size)