aboutsummaryrefslogtreecommitdiff
path: root/src/uint256.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-12-15 10:05:51 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-01-05 15:14:47 +0100
commit5d3064bc44e0b608a428e230f384bd3f846dedca (patch)
treeac2c58dcc7e4d4a49b8a8c8871cd4c570a79c4b5 /src/uint256.h
parenta043facf5a8b75eb15547ed788296b6c3df2c586 (diff)
Temporarily add SetNull/IsNull/GetCheapHash to base_uint
Also add a stub for arith_uint256 and its conversion functions, for now completely based on uint256. Eases step-by-step migration to blob.
Diffstat (limited to 'src/uint256.h')
-rw-r--r--src/uint256.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/uint256.h b/src/uint256.h
index 139270ac49..8189b27cb3 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -283,6 +283,23 @@ public:
{
s.read((char*)pn, sizeof(pn));
}
+
+ // Temporary for migration to opaque uint160/256
+ uint64_t GetCheapHash() const
+ {
+ return GetLow64();
+ }
+ void SetNull()
+ {
+ memset(pn, 0, sizeof(pn));
+ }
+ bool IsNull() const
+ {
+ for (int i = 0; i < WIDTH; i++)
+ if (pn[i] != 0)
+ return false;
+ return true;
+ }
};
/** 160-bit unsigned big integer. */
@@ -330,4 +347,7 @@ public:
uint64_t GetHash(const uint256& salt) const;
};
+// Temporary for migration to opaque uint160/256
+inline uint256 uint256S(const std::string &x) { return uint256(x); }
+
#endif // BITCOIN_UINT256_H