MCPcopy Create free account
hub / github.com/couchbase/fleece / findNearest

Method findNearest

Fleece/Tree/MutableNode.hh:152–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

asImmutableMethod · 0.80
NodeRefClass · 0.70
isLeafMethod · 0.45
isMutableMethod · 0.45
asMutableMethod · 0.45

Tested by

no test coverage detected