mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Endian fix. SHAMap now passes its (admittedly anemic right now) unit test.
This commit is contained in:
@@ -15,7 +15,7 @@ std::string SHAMapNode::getString() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 SHAMapNode::smMasks[11];
|
uint256 SHAMapNode::smMasks[21];
|
||||||
|
|
||||||
bool SHAMapNode::operator<(const SHAMapNode &s) const
|
bool SHAMapNode::operator<(const SHAMapNode &s) const
|
||||||
{
|
{
|
||||||
@@ -57,16 +57,11 @@ bool SHAMapNode::operator!=(const SHAMapNode &s) const
|
|||||||
|
|
||||||
void SHAMapNode::ClassInit()
|
void SHAMapNode::ClassInit()
|
||||||
{ // set up the depth masks
|
{ // set up the depth masks
|
||||||
int i;
|
uint256 selector;
|
||||||
char HexBuf[65];
|
for(int i=0; i<=leafDepth; i++)
|
||||||
|
|
||||||
for(i=0; i<64; i++) HexBuf[i]='0';
|
|
||||||
HexBuf[64]=0;
|
|
||||||
for(i=0; i<=leafDepth; i++)
|
|
||||||
{
|
{
|
||||||
smMasks[i].SetHex(HexBuf);
|
smMasks[i]=selector;
|
||||||
HexBuf[2*i]='1';
|
*(selector.begin()+i)=0x1f;
|
||||||
HexBuf[2*i+1]='F';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +83,11 @@ SHAMapNode SHAMapNode::getChildNodeID(int m)
|
|||||||
assert(!isLeaf());
|
assert(!isLeaf());
|
||||||
|
|
||||||
uint256 branch=m;
|
uint256 branch=m;
|
||||||
branch>>=(mDepth*8);
|
branch<<=248-(mDepth*8);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cerr << "m=" << m << ", branch=" << branch.GetHex() << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
return SHAMapNode(mDepth+1, mNodeID | branch);
|
return SHAMapNode(mDepth+1, mNodeID | branch);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user