aboutsummaryrefslogtreecommitdiff
path: root/src/arith_uint256.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-12-19 13:08:06 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-03-06 17:21:59 +0100
commitf4e6487219d4b861df71e80d89d864ff6f312d17 (patch)
treec8b9005d0d53616c66e6ef12cbc5b6091295a793 /src/arith_uint256.cpp
parentaac320537523f1df1523adeba22a8498884715c9 (diff)
downloadbitcoin-f4e6487219d4b861df71e80d89d864ff6f312d17.tar.xz
src/arith_256.cpp: bigendian compatibility
Diffstat (limited to 'src/arith_uint256.cpp')
-rw-r--r--src/arith_uint256.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp
index 1243823da5..2e61363576 100644
--- a/src/arith_uint256.cpp
+++ b/src/arith_uint256.cpp
@@ -7,6 +7,7 @@
#include "uint256.h"
#include "utilstrencodings.h"
+#include "crypto/common.h"
#include <stdio.h>
#include <string.h>
@@ -246,14 +247,14 @@ uint32_t arith_uint256::GetCompact(bool fNegative) const
uint256 ArithToUint256(const arith_uint256 &a)
{
uint256 b;
- // TODO: needs bswap32 on big-endian
- memcpy(b.begin(), a.pn, a.size());
+ for(int x=0; x<a.WIDTH; ++x)
+ WriteLE32(b.begin() + x*4, a.pn[x]);
return b;
}
arith_uint256 UintToArith256(const uint256 &a)
{
arith_uint256 b;
- // TODO: needs bswap32 on big-endian
- memcpy(b.pn, a.begin(), a.size());
+ for(int x=0; x<b.WIDTH; ++x)
+ b.pn[x] = ReadLE32(a.begin() + x*4);
return b;
}