mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -37,6 +37,9 @@ private:
|
||||
|
||||
void setHash() const;
|
||||
|
||||
protected:
|
||||
SHAMapNode(int depth, const uint256& id, bool) : mNodeID(id), mDepth(depth), mHash(0) { ; }
|
||||
|
||||
public:
|
||||
|
||||
static const int rootDepth = 0;
|
||||
@@ -63,13 +66,14 @@ public:
|
||||
|
||||
bool operator<(const SHAMapNode&) const;
|
||||
bool operator>(const SHAMapNode&) const;
|
||||
bool operator==(const SHAMapNode&) const;
|
||||
bool operator==(const uint256&) const;
|
||||
bool operator!=(const SHAMapNode&) const;
|
||||
bool operator!=(const uint256&) const;
|
||||
bool operator<=(const SHAMapNode&) const;
|
||||
bool operator>=(const SHAMapNode&) const;
|
||||
|
||||
bool operator==(const SHAMapNode& n) const { return (mDepth == n.mDepth) && (mNodeID == n.mNodeID); }
|
||||
bool operator==(const uint256& n) const { return n == mNodeID; }
|
||||
bool operator!=(const SHAMapNode& n) const { return (mDepth != n.mDepth) || (mNodeID != n.mNodeID); }
|
||||
bool operator!=(const uint256& n) const { return n != mNodeID; }
|
||||
|
||||
virtual std::string getString() const;
|
||||
void dump() const;
|
||||
|
||||
|
||||
@@ -60,26 +60,6 @@ bool SHAMapNode::operator>=(const SHAMapNode &s) const
|
||||
return mNodeID >= s.mNodeID;
|
||||
}
|
||||
|
||||
bool SHAMapNode::operator==(const SHAMapNode &s) const
|
||||
{
|
||||
return (s.mDepth == mDepth) && (s.mNodeID == mNodeID);
|
||||
}
|
||||
|
||||
bool SHAMapNode::operator!=(const SHAMapNode &s) const
|
||||
{
|
||||
return (s.mDepth != mDepth) || (s.mNodeID != mNodeID);
|
||||
}
|
||||
|
||||
bool SHAMapNode::operator==(const uint256 &s) const
|
||||
{
|
||||
return s == mNodeID;
|
||||
}
|
||||
|
||||
bool SHAMapNode::operator!=(const uint256 &s) const
|
||||
{
|
||||
return s != mNodeID;
|
||||
}
|
||||
|
||||
bool SMN_j = SHAMapNode::ClassInit();
|
||||
|
||||
bool SHAMapNode::ClassInit()
|
||||
@@ -102,9 +82,10 @@ uint256 SHAMapNode::getNodeID(int depth, const uint256& hash)
|
||||
return hash & smMasks[depth];
|
||||
}
|
||||
|
||||
SHAMapNode::SHAMapNode(int depth, const uint256 &hash) : mNodeID(getNodeID(depth,hash)), mDepth(depth), mHash(0)
|
||||
SHAMapNode::SHAMapNode(int depth, const uint256 &hash) : mNodeID(hash), mDepth(depth), mHash(0)
|
||||
{ // canonicalize the hash to a node ID for this depth
|
||||
assert((depth >= 0) && (depth < 65));
|
||||
mNodeID &= smMasks[depth];
|
||||
}
|
||||
|
||||
SHAMapNode::SHAMapNode(const void *ptr, int len) : mHash(0)
|
||||
@@ -136,10 +117,9 @@ SHAMapNode SHAMapNode::getChildNodeID(int m) const
|
||||
assert((m >= 0) && (m < 16));
|
||||
|
||||
uint256 child(mNodeID);
|
||||
child.begin()[mDepth/2] |= (mDepth & 1) ? m : (m << 4);
|
||||
|
||||
child.begin()[mDepth/2] |= (mDepth & 1) ? m : m << 4;
|
||||
|
||||
return SHAMapNode(mDepth + 1, child);
|
||||
return SHAMapNode(mDepth + 1, child, true);
|
||||
}
|
||||
|
||||
int SHAMapNode::selectBranch(const uint256& hash) const
|
||||
|
||||
Reference in New Issue
Block a user