| 150 | |
| 151 | |
| 152 | NodeRef findNearest(hash_t hash) const { |
| 153 | unsigned bitNo = childBitNumber(hash); |
| 154 | if (!hasChild(bitNo)) |
| 155 | return NodeRef(); |
| 156 | NodeRef child = childForBitNumber(bitNo); |
| 157 | if (child.isLeaf()) { |
| 158 | return child; |
| 159 | } else if (child.isMutable()) { |
| 160 | auto mchild = child.asMutable(); |
| 161 | return ((MutableInterior*)mchild)->findNearest(hash >> kBitShift); // recurse... |
| 162 | } else { |
| 163 | auto ichild = child.asImmutable(); |
| 164 | return ichild->interior.findNearest(hash >> kBitShift); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | |
| 169 | // Recursive insertion method. On success returns either 'this', or a new node that |
nothing calls this directly
no test coverage detected