From 0d27bc0f8763cb6dd6307dbab7713058dee18b2c Mon Sep 17 00:00:00 2001 From: lloyd <lloyd@randombit.net> Date: Tue, 17 Nov 2009 05:03:06 +0000 Subject: Rename/remove some secmem member variables for better matching with STL containers (specifically vector). Rename is_empty to empty Remove has_items Rename create to resize --- src/math/bigint/bigint.cpp | 10 +++++----- src/math/bigint/divide.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/math/bigint') diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp index 63bdc3605..7592ec439 100644 --- a/src/math/bigint/bigint.cpp +++ b/src/math/bigint/bigint.cpp @@ -25,7 +25,7 @@ BigInt::BigInt(u64bit n) const u32bit limbs_needed = sizeof(u64bit) / sizeof(word); - reg.create(4*limbs_needed); + reg.resize(4*limbs_needed); for(u32bit j = 0; j != limbs_needed; ++j) reg[j] = ((n >> (j*MP_WORD_BITS)) & MP_WORD_MASK); } @@ -35,7 +35,7 @@ BigInt::BigInt(u64bit n) */ BigInt::BigInt(Sign s, u32bit size) { - reg.create(round_up(size, 8)); + reg.resize(round_up(size, 8)); signedness = s; } @@ -48,13 +48,13 @@ BigInt::BigInt(const BigInt& b) if(b_words) { - reg.create(round_up(b_words, 8)); + reg.resize(round_up(b_words, 8)); reg.copy(b.data(), b_words); set_sign(b.sign()); } else { - reg.create(2); + reg.resize(2); set_sign(Positive); } } @@ -346,7 +346,7 @@ void BigInt::binary_decode(const byte buf[], u32bit length) { const u32bit WORD_BYTES = sizeof(word); - reg.create(round_up((length / WORD_BYTES) + 1, 8)); + reg.resize(round_up((length / WORD_BYTES) + 1, 8)); for(u32bit j = 0; j != length / WORD_BYTES; ++j) { diff --git a/src/math/bigint/divide.cpp b/src/math/bigint/divide.cpp index 6afaa0fee..45d31350d 100644 --- a/src/math/bigint/divide.cpp +++ b/src/math/bigint/divide.cpp @@ -62,7 +62,7 @@ void divide(const BigInt& x, const BigInt& y_arg, BigInt& q, BigInt& r) const u32bit n = r.sig_words() - 1, t = y_words - 1; - q.get_reg().create(n - t + 1); + q.get_reg().resize(n - t + 1); if(n <= t) { while(r > y) { r -= y; ++q; } -- cgit v1.2.3