Commit bea4fa7f authored by Milo Yip's avatar Milo Yip

Remove unused BigInteger::operator+=(const BigInteger&)

parent cbd74752
......@@ -122,22 +122,6 @@ public:
return *this;
}
BigInteger& operator+=(const BigInteger& rhs) {
size_t count = count_ > rhs.count_ ? count_ : rhs.count_;
bool carry = false;
for (size_t i = 0; i < count; i++) {
bool outCarry;
digits_[i] = FullAdd(i < count_ ? digits_[i] : 0, i < rhs.count_ ? rhs.digits_[i] : 0, carry, &outCarry);
carry = outCarry;
}
count_ = count;
if (carry)
PushBack(1);
return *this;
}
BigInteger& operator*=(uint64_t u) {
if (u == 0) return *this = 0;
if (u == 1) return *this;
......
......@@ -66,30 +66,6 @@ TEST(Strtod, BigInteger_AddUint64) {
EXPECT_TRUE(BIGINTEGER_LITERAL("36893488147419103231") == b);
}
TEST(Strtod, BigInteger_Add) {
BigInteger a = kZero;
a += kZero;
EXPECT_TRUE(kZero == a);
a += kOne;
EXPECT_TRUE(kOne == a);
a += kOne;
EXPECT_TRUE(BigInteger(2) == a);
a = kUint64Max;
a += kOne;
EXPECT_TRUE(kTwo64 == a);
a = kOne;
a += kTwo64;
EXPECT_TRUE(BIGINTEGER_LITERAL("18446744073709551617") == a);
a = kTwo64;
a += kOne;
EXPECT_TRUE(BIGINTEGER_LITERAL("18446744073709551617") == a);
}
TEST(Strtod, BigInteger_MultiplyUint64) {
BigInteger a = kZero;
a *= static_cast <uint64_t>(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment