mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Add isZero/isNonZero to avoid !!hash constructs.
This commit is contained in:
13
uint256.h
13
uint256.h
@@ -33,6 +33,19 @@ protected:
|
|||||||
unsigned int pn[WIDTH];
|
unsigned int pn[WIDTH];
|
||||||
public:
|
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
|
bool operator!() const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < WIDTH; i++)
|
for (int i = 0; i < WIDTH; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user