aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/numbertheory
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-18 23:30:32 +0000
committerlloyd <[email protected]>2010-10-18 23:30:32 +0000
commitc715624c6b71327fbeb336654666899300a484cb (patch)
treec300fc3d241014faf8f449a0d5467ff5a1faf9f1 /src/math/numbertheory
parentde943fee887bf594583753fe0c42e44527278bb1 (diff)
BigInt::get_substring really shouldn't return size_t. Revert to
u32bit. Maybe should be word? But that would restrict window sizes more than might be desirable (we couldn't use more than 8 bit window on the assumption that the lib might be using byte limbs). Messy.
Diffstat (limited to 'src/math/numbertheory')
-rw-r--r--src/math/numbertheory/point_gfp.cpp6
-rw-r--r--src/math/numbertheory/powm_fw.cpp3
-rw-r--r--src/math/numbertheory/powm_mnt.cpp3
3 files changed, 5 insertions, 7 deletions
diff --git a/src/math/numbertheory/point_gfp.cpp b/src/math/numbertheory/point_gfp.cpp
index 5da1959bc..8cb40270c 100644
--- a/src/math/numbertheory/point_gfp.cpp
+++ b/src/math/numbertheory/point_gfp.cpp
@@ -324,12 +324,12 @@ PointGFp operator*(const BigInt& scalar, const PointGFp& point)
while(bits_left >= window_size)
{
- size_t nibble = scalar.get_substring(bits_left - window_size,
- window_size);
-
for(size_t i = 0; i != window_size; ++i)
H.mult2(ws);
+ const u32bit nibble = scalar.get_substring(bits_left - window_size,
+ window_size);
+
if(nibble)
H.add(Ps[nibble-1], ws);
diff --git a/src/math/numbertheory/powm_fw.cpp b/src/math/numbertheory/powm_fw.cpp
index afc53f233..3348e55cd 100644
--- a/src/math/numbertheory/powm_fw.cpp
+++ b/src/math/numbertheory/powm_fw.cpp
@@ -45,8 +45,7 @@ BigInt Fixed_Window_Exponentiator::execute() const
for(size_t k = 0; k != window_bits; ++k)
x = reducer.square(x);
- size_t nibble = exp.get_substring(window_bits*(j-1), window_bits);
- if(nibble)
+ if(u32bit nibble = exp.get_substring(window_bits*(j-1), window_bits))
x = reducer.multiply(x, g[nibble-1]);
}
return x;
diff --git a/src/math/numbertheory/powm_mnt.cpp b/src/math/numbertheory/powm_mnt.cpp
index 038ce14da..4f626ac9d 100644
--- a/src/math/numbertheory/powm_mnt.cpp
+++ b/src/math/numbertheory/powm_mnt.cpp
@@ -90,8 +90,7 @@ BigInt Montgomery_Exponentiator::execute() const
x.get_reg().set(&z[0], mod_words + 1);
}
- size_t nibble = exp.get_substring(window_bits*(i-1), window_bits);
- if(nibble)
+ if(u32bit nibble = exp.get_substring(window_bits*(i-1), window_bits))
{
const BigInt& y = g[nibble-1];