Bugfixes and new unit test.

This commit is contained in:
JoelKatz
2012-02-07 16:54:59 -08:00
parent 60d403725c
commit 29d24c0af8
4 changed files with 152 additions and 28 deletions

View File

@@ -279,14 +279,16 @@ bool SHAMapTreeNode::setItem(SHAMapItem::pointer& i, TNType type)
SHAMapItem::pointer SHAMapTreeNode::getItem() const
{
assert(isLeaf());
return boost::make_shared<SHAMapItem>(*mItem);
}
int SHAMapTreeNode::getBranchCount() const
{
assert(isInner());
int ret=0;
for(int i=0; i<16; i++)
if(!mHashes[i]) ret++;
for(int i=0; i<16; ++i)
if(!!mHashes[i]) ++ret;
return ret;
}