mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Install SHAMapInnerNodeV2
* Inner node optimization.
This commit is contained in:
@@ -102,7 +102,7 @@ std::string SHAMapNodeID::getRawString () const
|
||||
SHAMapNodeID SHAMapNodeID::getChildNodeID (int m) const
|
||||
{
|
||||
assert ((m >= 0) && (m < 16));
|
||||
assert (mDepth <= 64);
|
||||
assert (mDepth < 64);
|
||||
|
||||
uint256 child (mNodeID);
|
||||
child.begin ()[mDepth / 2] |= (mDepth & 1) ? m : (m << 4);
|
||||
@@ -143,6 +143,25 @@ int SHAMapNodeID::selectBranch (uint256 const& hash) const
|
||||
return branch;
|
||||
}
|
||||
|
||||
bool
|
||||
SHAMapNodeID::has_common_prefix(SHAMapNodeID const& other) const
|
||||
{
|
||||
assert(mDepth <= other.mDepth);
|
||||
auto x = mNodeID.begin();
|
||||
auto y = other.mNodeID.begin();
|
||||
for (unsigned i = 0; i < mDepth/2; ++i, ++x, ++y)
|
||||
{
|
||||
if (*x != *y)
|
||||
return false;
|
||||
}
|
||||
if (mDepth & 1)
|
||||
{
|
||||
auto i = mDepth/2;
|
||||
return (*(mNodeID.begin() + i) & 0xF0) == (*(other.mNodeID.begin() + i) & 0xF0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SHAMapNodeID::dump (beast::Journal journal) const
|
||||
{
|
||||
JLOG(journal.debug()) <<
|
||||
|
||||
Reference in New Issue
Block a user