diff options
author | lloyd <[email protected]> | 2010-10-12 16:19:56 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-12 16:19:56 +0000 |
commit | 4a6fd8c70d40f88c8b51127bfa055b66b18e0f7a (patch) | |
tree | d8c5697f8de1fff74c5b813fd83c08d310fa8ac0 /src/math/mp/monty_generic | |
parent | c46a5e8d3dd8f07a92fc90027e6f7f70b989ea47 (diff) |
Use size_t in all of math, remove to_u32bit
Diffstat (limited to 'src/math/mp/monty_generic')
-rw-r--r-- | src/math/mp/monty_generic/mp_monty.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/math/mp/monty_generic/mp_monty.cpp b/src/math/mp/monty_generic/mp_monty.cpp index bce35259a..d7f7e0306 100644 --- a/src/math/mp/monty_generic/mp_monty.cpp +++ b/src/math/mp/monty_generic/mp_monty.cpp @@ -18,14 +18,14 @@ extern "C" { /* * Montgomery Reduction Algorithm */ -void bigint_monty_redc(word z[], u32bit z_size, +void bigint_monty_redc(word z[], size_t z_size, word ws[], - const word x[], u32bit x_size, + const word x[], size_t x_size, word u) { - const u32bit blocks_of_8 = x_size - (x_size % 8); + const size_t blocks_of_8 = x_size - (x_size % 8); - for(u32bit i = 0; i != x_size; ++i) + for(size_t i = 0; i != x_size; ++i) { word* z_i = z + i; @@ -37,10 +37,10 @@ void bigint_monty_redc(word z[], u32bit z_size, */ word carry = 0; - for(u32bit j = 0; j != blocks_of_8; j += 8) + for(size_t j = 0; j != blocks_of_8; j += 8) carry = word8_madd3(z_i + j, x + j, y, carry); - for(u32bit j = blocks_of_8; j != x_size; ++j) + for(size_t j = blocks_of_8; j != x_size; ++j) z_i[j] = word_madd3(x[j], y, z_i[j], &carry); word z_sum = z_i[x_size] + carry; @@ -48,7 +48,7 @@ void bigint_monty_redc(word z[], u32bit z_size, z_i[x_size] = z_sum; // Note: not constant time - for(u32bit j = x_size + 1; carry && j != z_size - i; ++j) + for(size_t j = x_size + 1; carry && j != z_size - i; ++j) { ++z_i[j]; carry = !z_i[j]; @@ -56,7 +56,7 @@ void bigint_monty_redc(word z[], u32bit z_size, } word borrow = 0; - for(u32bit i = 0; i != x_size; ++i) + for(size_t i = 0; i != x_size; ++i) ws[i] = word_sub(z[x_size + i], x[i], &borrow); ws[x_size] = word_sub(z[x_size+x_size], 0, &borrow); |