src/arith_256.cpp: bigendian compatibility
This commit is contained in:
parent
aac3205375
commit
f4e6487219
1 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
|
#include "crypto/common.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -246,14 +247,14 @@ uint32_t arith_uint256::GetCompact(bool fNegative) const
|
||||||
uint256 ArithToUint256(const arith_uint256 &a)
|
uint256 ArithToUint256(const arith_uint256 &a)
|
||||||
{
|
{
|
||||||
uint256 b;
|
uint256 b;
|
||||||
// TODO: needs bswap32 on big-endian
|
for(int x=0; x<a.WIDTH; ++x)
|
||||||
memcpy(b.begin(), a.pn, a.size());
|
WriteLE32(b.begin() + x*4, a.pn[x]);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
arith_uint256 UintToArith256(const uint256 &a)
|
arith_uint256 UintToArith256(const uint256 &a)
|
||||||
{
|
{
|
||||||
arith_uint256 b;
|
arith_uint256 b;
|
||||||
// TODO: needs bswap32 on big-endian
|
for(int x=0; x<b.WIDTH; ++x)
|
||||||
memcpy(b.pn, a.begin(), a.size());
|
b.pn[x] = ReadLE32(a.begin() + x*4);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue