Implement = operator for BigInteger

There's a copy constructor, but no '=' operator implemented. This is dangerous.
This commit is contained in:
blackball 2015-08-07 10:04:45 +02:00
parent fc50f103a6
commit c0854473e9

View File

@ -51,7 +51,14 @@ public:
if (length > 0)
AppendDecimal64(decimals + i, decimals + i + length);
}
BigInteger& operator=(const BigInteger &rhs)
{
count_ = rhs.count_;
std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type));
return *this;
}
BigInteger& operator=(uint64_t u) {
digits_[0] = u;
count_ = 1;