mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Cleanups and optimizations.
This commit is contained in:
4
SHAMap.h
4
SHAMap.h
@@ -72,9 +72,9 @@ class hash_SMN
|
|||||||
{ // These must be randomized for release
|
{ // These must be randomized for release
|
||||||
public:
|
public:
|
||||||
std::size_t operator() (const SHAMapNode& mn) const
|
std::size_t operator() (const SHAMapNode& mn) const
|
||||||
{ return mn.getDepth() ^ static_cast<std::size_t>(mn.getNodeID().PeekAt(0)); }
|
{ return mn.getDepth() ^ static_cast<std::size_t>(mn.getNodeID().GetAt(0)); }
|
||||||
std::size_t operator() (const uint256& u) const
|
std::size_t operator() (const uint256& u) const
|
||||||
{ return static_cast<std::size_t>(u.PeekAt(0)); }
|
{ return static_cast<std::size_t>(u.GetAt(0)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class SHAMapItem
|
class SHAMapItem
|
||||||
|
|||||||
@@ -99,10 +99,9 @@ SHAMapNode SHAMapNode::getChildNodeID(int m) const
|
|||||||
{ // This can be optimized to avoid the << if needed
|
{ // This can be optimized to avoid the << if needed
|
||||||
assert((m>=0) && (m<16));
|
assert((m>=0) && (m<16));
|
||||||
|
|
||||||
uint256 branch=m;
|
uint256 child(mNodeID);
|
||||||
branch<<=mDepth*4;
|
child.PeekAt(mDepth/8) |= m << (4*(mDepth%8));
|
||||||
|
return SHAMapNode(mDepth+1, child);
|
||||||
return SHAMapNode(mDepth+1, mNodeID | branch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SHAMapNode::selectBranch(const uint256& hash) const
|
int SHAMapNode::selectBranch(const uint256& hash) const
|
||||||
|
|||||||
Reference in New Issue
Block a user