Commit 3ede21c3 authored by Milo Yip's avatar Milo Yip

Merge pull request #409 from pah/fix/biginteger-self-assign

BigInteger: guard against self-assignment
parents 3cf7228f afbc0406
...@@ -54,8 +54,10 @@ public: ...@@ -54,8 +54,10 @@ public:
BigInteger& operator=(const BigInteger &rhs) BigInteger& operator=(const BigInteger &rhs)
{ {
if (this != &rhs) {
count_ = rhs.count_; count_ = rhs.count_;
std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type)); std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type));
}
return *this; return *this;
} }
......
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