Skip to content

Commit

Permalink
feat: overload equality operator in bignum
Browse files Browse the repository at this point in the history
  • Loading branch information
as-iotex authored and as-iotex committed Apr 17, 2022
1 parent 707b258 commit a51f358
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bignum/bignum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ Bignum& Bignum::operator=(const Bignum& bignum)
{
_u256 = uint256_t(bignum.ToString(NumericBase::Base16).c_str(), 16);
return *this;
}

bool Bignum::operator==(const Bignum& c) const
{
return _u256 == c._u256;
}
2 changes: 2 additions & 0 deletions src/bignum/bignum.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Bignum

Bignum& operator=(const Bignum& bignum);

bool operator==(const Bignum& c) const;

private:
uint256_t _u256;
};
Expand Down

0 comments on commit a51f358

Please sign in to comment.