| 383 | */ |
| 384 | template <typename Key> |
| 385 | static void fix(Radix::Node<Key> *node) |
| 386 | { |
| 387 | Key key = ~(Key)0; |
| 388 | |
| 389 | for (unsigned i = 0; i < BRANCH_MAX; i++) |
| 390 | { |
| 391 | Radix::Node<Key> *child = node->child[i]; |
| 392 | if (child == nullptr) |
| 393 | continue; |
| 394 | key = (key & child->key); |
| 395 | } |
| 396 | |
| 397 | node->key = key; |
| 398 | } |
| 399 | |
| 400 | /* |
| 401 | * Find the leaf node for the given key. |