Remove unused BigInteger::operator+=(const BigInteger&)
This commit is contained in:
parent
cbd7475242
commit
bea4fa7f6a
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user