aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/mp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/mp')
-rw-r--r--src/math/mp/mp_core.h6
-rw-r--r--src/math/mp/mp_misc.cpp33
2 files changed, 5 insertions, 34 deletions
diff --git a/src/math/mp/mp_core.h b/src/math/mp/mp_core.h
index c879f42ee..579f3fef4 100644
--- a/src/math/mp/mp_core.h
+++ b/src/math/mp/mp_core.h
@@ -126,12 +126,6 @@ void bigint_monty_sqr(word z[], size_t z_size,
const word p[], size_t p_size, word p_dash,
word workspace[]);
-/*
-* Division operation
-*/
-size_t bigint_divcore(word q, word y2, word y1,
- word x3, word x2, word x1);
-
/**
* Compare x and y
*/
diff --git a/src/math/mp/mp_misc.cpp b/src/math/mp/mp_misc.cpp
index 0232f01d6..2aff00592 100644
--- a/src/math/mp/mp_misc.cpp
+++ b/src/math/mp/mp_misc.cpp
@@ -13,29 +13,6 @@ namespace Botan {
extern "C" {
/*
-* Core Division Operation
-*/
-size_t bigint_divcore(word q, word y2, word y1,
- word x3, word x2, word x1)
- {
- // Compute (y2,y1) * q
-
- word y3 = 0;
- y1 = word_madd2(q, y1, &y3);
- y2 = word_madd2(q, y2, &y3);
-
- // Return (y3,y2,y1) >? (x3,x2,x1)
-
- if(y3 > x3) return 1;
- if(y3 < x3) return 0;
- if(y2 > x2) return 1;
- if(y2 < x2) return 0;
- if(y1 > x1) return 1;
- if(y1 < x1) return 0;
- return 0;
- }
-
-/*
* Compare two MP integers
*/
s32bit bigint_cmp(const word x[], size_t x_size,
@@ -50,11 +27,11 @@ s32bit bigint_cmp(const word x[], size_t x_size,
x_size--;
}
- for(size_t j = x_size; j > 0; --j)
+ for(size_t i = x_size; i > 0; --i)
{
- if(x[j-1] > y[j-1])
+ if(x[i-1] > y[i-1])
return 1;
- if(x[j-1] < y[j-1])
+ if(x[i-1] < y[i-1])
return -1;
}
@@ -68,12 +45,12 @@ word bigint_divop(word n1, word n0, word d)
{
word high = n1 % d, quotient = 0;
- for(size_t j = 0; j != MP_WORD_BITS; ++j)
+ for(size_t i = 0; i != MP_WORD_BITS; ++i)
{
word high_top_bit = (high & MP_WORD_TOP_BIT);
high <<= 1;
- high |= (n0 >> (MP_WORD_BITS-1-j)) & 1;
+ high |= (n0 >> (MP_WORD_BITS-1-i)) & 1;
quotient <<= 1;
if(high_top_bit || high >= d)