MCPcopy Create free account
hub / github.com/GJDuck/e9patch / findAnyComplement

Function findAnyComplement

src/e9patch/e9mapping.cpp:421–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419 */
420template <typename Key>
421static Radix::Node<Key> *findAnyComplement(Radix::Node<Key> *node, Key key)
422{
423 if (node == nullptr)
424 return nullptr;
425 if (!node->inner)
426 return ((node->key & key) == 0? node: nullptr);
427 for (unsigned i = 0; i < BRANCH_MAX; i++)
428 {
429 Radix::Node<Key> *child = node->child[i];
430 if (child == nullptr)
431 continue;
432 if ((key & child->key) != 0)
433 continue;
434 Radix::Node<Key> *result = findAnyComplement(child, key);
435 if (result != nullptr)
436 return result;
437 }
438
439 return nullptr;
440}
441
442/*
443 * Insert a new mapping into the tree.

Callers 1

mergeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected