kernel/src/vm/MapTree.h
/**
         * Finds the first mapping that overlaps the given range, if any.
         * TODO: optimize to avoid visiting every node in the tree...
         *
         * @return Node corresponding to the first overlapping map, or `nullptr`
         */
Finds the first mapping that overlaps the given range, if any.
TODO: optimize to avoid visiting every node in the tree

@return Node corresponding to the first overlapping map, or `nullptr`
Finds the first mapping that overlaps the given range if any . TODO : optimize to avoid visiting every node in the tree @return Node corresponding to the first overlapping map or ` nullptr `
MapTreeLeaf *findOverlapping(const uintptr_t base, const size_t length, MapTreeLeaf *node) {
            if(!node) return nullptr;
            else if(node->contains(base, length)) {
                return node;
            }
            auto left = this->findOverlapping(base, length, node->left);
            if(left) return left;
            return this->findOverlapping(base, length, node->right);
        }
MapTreeLeaf * findOverlapping ( const uintptr_t base , const size_t length , MapTreeLeaf * node ) { if ( ! node ) return nullptr ; else if ( node -> contains ( base , length ) ) { return node ; } auto left = this -> findOverlapping ( base , length , node -> left ) ; if ( left ) return left ; return this -> findOverlapping ( base , length , node -> right ) ; }
Finds the first mapping that overlaps the given range, if any.
Finds the first mapping that overlaps the given range if any .
// bail if end of subtree // does this node overlap the range? // recurse down the remainder of the tree