diff options
Diffstat (limited to 'src/math/mp/mp_asm.cpp')
-rw-r--r-- | src/math/mp/mp_asm.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/math/mp/mp_asm.cpp b/src/math/mp/mp_asm.cpp index 4fcdee7a4..d164c1d33 100644 --- a/src/math/mp/mp_asm.cpp +++ b/src/math/mp/mp_asm.cpp @@ -19,19 +19,19 @@ extern "C" { /* * Two Operand Addition, No Carry */ -word bigint_add2_nc(word x[], u32bit x_size, const word y[], u32bit y_size) +word bigint_add2_nc(word x[], size_t x_size, const word y[], size_t y_size) { word carry = 0; - const u32bit blocks = y_size - (y_size % 8); + const size_t blocks = y_size - (y_size % 8); - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) carry = word8_add2(x + i, y + i, carry); - for(u32bit i = blocks; i != y_size; ++i) + for(size_t i = blocks; i != y_size; ++i) x[i] = word_add(x[i], y[i], &carry); - for(u32bit i = y_size; i != x_size; ++i) + for(size_t i = y_size; i != x_size; ++i) x[i] = word_add(x[i], 0, &carry); return carry; @@ -40,23 +40,23 @@ word bigint_add2_nc(word x[], u32bit x_size, const word y[], u32bit y_size) /* * Three Operand Addition, No Carry */ -word bigint_add3_nc(word z[], const word x[], u32bit x_size, - const word y[], u32bit y_size) +word bigint_add3_nc(word z[], const word x[], size_t x_size, + const word y[], size_t y_size) { if(x_size < y_size) { return bigint_add3_nc(z, y, y_size, x, x_size); } word carry = 0; - const u32bit blocks = y_size - (y_size % 8); + const size_t blocks = y_size - (y_size % 8); - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) carry = word8_add3(z + i, x + i, y + i, carry); - for(u32bit i = blocks; i != y_size; ++i) + for(size_t i = blocks; i != y_size; ++i) z[i] = word_add(x[i], y[i], &carry); - for(u32bit i = y_size; i != x_size; ++i) + for(size_t i = y_size; i != x_size; ++i) z[i] = word_add(x[i], 0, &carry); return carry; @@ -65,7 +65,7 @@ word bigint_add3_nc(word z[], const word x[], u32bit x_size, /* * Two Operand Addition */ -void bigint_add2(word x[], u32bit x_size, const word y[], u32bit y_size) +void bigint_add2(word x[], size_t x_size, const word y[], size_t y_size) { x[x_size] += bigint_add2_nc(x, x_size, y, y_size); } @@ -73,8 +73,8 @@ void bigint_add2(word x[], u32bit x_size, const word y[], u32bit y_size) /* * Three Operand Addition */ -void bigint_add3(word z[], const word x[], u32bit x_size, - const word y[], u32bit y_size) +void bigint_add3(word z[], const word x[], size_t x_size, + const word y[], size_t y_size) { z[(x_size > y_size ? x_size : y_size)] += bigint_add3_nc(z, x, x_size, y, y_size); @@ -83,19 +83,19 @@ void bigint_add3(word z[], const word x[], u32bit x_size, /* * Two Operand Subtraction */ -word bigint_sub2(word x[], u32bit x_size, const word y[], u32bit y_size) +word bigint_sub2(word x[], size_t x_size, const word y[], size_t y_size) { word borrow = 0; - const u32bit blocks = y_size - (y_size % 8); + const size_t blocks = y_size - (y_size % 8); - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) borrow = word8_sub2(x + i, y + i, borrow); - for(u32bit i = blocks; i != y_size; ++i) + for(size_t i = blocks; i != y_size; ++i) x[i] = word_sub(x[i], y[i], &borrow); - for(u32bit i = y_size; i != x_size; ++i) + for(size_t i = y_size; i != x_size; ++i) x[i] = word_sub(x[i], 0, &borrow); return borrow; @@ -104,16 +104,16 @@ word bigint_sub2(word x[], u32bit x_size, const word y[], u32bit y_size) /* * Two Operand Subtraction x = y - x */ -void bigint_sub2_rev(word x[], const word y[], u32bit y_size) +void bigint_sub2_rev(word x[], const word y[], size_t y_size) { word borrow = 0; - const u32bit blocks = y_size - (y_size % 8); + const size_t blocks = y_size - (y_size % 8); - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) borrow = word8_sub2_rev(x + i, y + i, borrow); - for(u32bit i = blocks; i != y_size; ++i) + for(size_t i = blocks; i != y_size; ++i) x[i] = word_sub(y[i], x[i], &borrow); if(borrow) @@ -123,20 +123,20 @@ void bigint_sub2_rev(word x[], const word y[], u32bit y_size) /* * Three Operand Subtraction */ -word bigint_sub3(word z[], const word x[], u32bit x_size, - const word y[], u32bit y_size) +word bigint_sub3(word z[], const word x[], size_t x_size, + const word y[], size_t y_size) { word borrow = 0; - const u32bit blocks = y_size - (y_size % 8); + const size_t blocks = y_size - (y_size % 8); - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) borrow = word8_sub3(z + i, x + i, y + i, borrow); - for(u32bit i = blocks; i != y_size; ++i) + for(size_t i = blocks; i != y_size; ++i) z[i] = word_sub(x[i], y[i], &borrow); - for(u32bit i = y_size; i != x_size; ++i) + for(size_t i = y_size; i != x_size; ++i) z[i] = word_sub(x[i], 0, &borrow); return borrow; @@ -145,16 +145,16 @@ word bigint_sub3(word z[], const word x[], u32bit x_size, /* * Two Operand Linear Multiply */ -void bigint_linmul2(word x[], u32bit x_size, word y) +void bigint_linmul2(word x[], size_t x_size, word y) { - const u32bit blocks = x_size - (x_size % 8); + const size_t blocks = x_size - (x_size % 8); word carry = 0; - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) carry = word8_linmul2(x + i, y, carry); - for(u32bit i = blocks; i != x_size; ++i) + for(size_t i = blocks; i != x_size; ++i) x[i] = word_madd2(x[i], y, &carry); x[x_size] = carry; @@ -163,16 +163,16 @@ void bigint_linmul2(word x[], u32bit x_size, word y) /* * Three Operand Linear Multiply */ -void bigint_linmul3(word z[], const word x[], u32bit x_size, word y) +void bigint_linmul3(word z[], const word x[], size_t x_size, word y) { - const u32bit blocks = x_size - (x_size % 8); + const size_t blocks = x_size - (x_size % 8); word carry = 0; - for(u32bit i = 0; i != blocks; i += 8) + for(size_t i = 0; i != blocks; i += 8) carry = word8_linmul3(z + i, x + i, y, carry); - for(u32bit i = blocks; i != x_size; ++i) + for(size_t i = blocks; i != x_size; ++i) z[i] = word_madd2(x[i], y, &carry); z[x_size] = carry; |