mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Add isZero/isNonZero to avoid !!hash constructs.
This commit is contained in:
15
uint256.h
15
uint256.h
@@ -33,6 +33,19 @@ protected:
|
||||
unsigned int pn[WIDTH];
|
||||
public:
|
||||
|
||||
bool isZero() const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
if (pn[i] != 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isNonZero() const
|
||||
{
|
||||
return !isZero();
|
||||
}
|
||||
|
||||
bool operator!() const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
@@ -279,7 +292,7 @@ public:
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
friend inline bool operator!=(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return (!(a == b));
|
||||
|
||||
Reference in New Issue
Block a user