diff options
| author | Wladimir J. van der Laan <[email protected]> | 2014-12-16 17:29:51 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-01-05 15:45:35 +0100 |
| commit | 92cdb1aace3c7343e9c9472061508d3b01d9883d (patch) | |
| tree | 19856b0e429cd7f5a166c3767e814f61f8a654f7 /src/arith_uint256.cpp | |
| parent | uint256->arith_uint256 blob256->uint256 (diff) | |
| download | discoin-92cdb1aace3c7343e9c9472061508d3b01d9883d.tar.xz discoin-92cdb1aace3c7343e9c9472061508d3b01d9883d.zip | |
Add conversion functions arith_uint256<->uint_256
Diffstat (limited to 'src/arith_uint256.cpp')
| -rw-r--r-- | src/arith_uint256.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 0dba429a8..f0b6a6a3b 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -5,6 +5,7 @@ #include "arith_uint256.h" +#include "uint256.h" #include "utilstrencodings.h" #include <stdio.h> @@ -355,3 +356,18 @@ uint64_t arith_uint256::GetHash(const arith_uint256& salt) const return ((((uint64_t)b) << 32) | c); } + +uint256 ArithToUint256(const arith_uint256 &a) +{ + uint256 b; + // TODO: needs bswap32 on big-endian + memcpy(b.begin(), a.pn, a.size()); + return b; +} +arith_uint256 UintToArith256(const uint256 &a) +{ + arith_uint256 b; + // TODO: needs bswap32 on big-endian + memcpy(b.pn, a.begin(), a.size()); + return b; +} |