mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add suport for name spaces to uint160extend256.
This commit is contained in:
@@ -709,7 +709,7 @@ inline const uint256 operator|(const uint256& a, const uint256& b) { return (b
|
||||
inline const uint256 operator+(const uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
|
||||
inline const uint256 operator-(const uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
|
||||
|
||||
uint256 uint160extend256(const uint160& uSource);
|
||||
uint256 uint160extend256(const uint160& uSource, uint uNamespace);
|
||||
|
||||
inline int Testuint256AdHoc(std::vector<std::string> vArg)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#include "utils.h"
|
||||
#include "uint256.h"
|
||||
|
||||
uint256 uint160extend256(const uint160& uSource)
|
||||
// XXX Assume little-endian.
|
||||
uint256 uint160extend256(const uint160& uSource, uint uNamespace)
|
||||
{
|
||||
uint256 uResult;
|
||||
|
||||
memcpy(uResult.begin() + (uResult.size() - uSource.size()), uSource.begin(), uSource.size());
|
||||
// Place right justified: in most significant bits.
|
||||
memcpy(uResult.end() - uSource.size(), uSource.begin(), uSource.size());
|
||||
uResult.begin()[uResult.size() - uSource.size() - 1] = uNamespace;
|
||||
|
||||
return uResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user