* Insert right-child helper. */
| 496 | * Insert right-child helper. |
| 497 | */ |
| 498 | static Node *insertRightChild(Node *root, intptr_t lb, intptr_t ub, size_t size, |
| 499 | uint32_t flags) |
| 500 | { |
| 501 | lb = std::max(lb, root->alloc.ub); |
| 502 | if ((intptr_t)size > ub - lb) |
| 503 | return nullptr; |
| 504 | flags = flag_set(flags, FLAG_LB, |
| 505 | (lb - root->alloc.ub < (ssize_t)PAGE_SIZE)); |
| 506 | Node *n; |
| 507 | if (root->entry.right == nullptr) |
| 508 | n = root->entry.right = node(root, lb, ub, size, flags); |
| 509 | else |
| 510 | n = insert(root->entry.right, lb, ub, size, flags); |
| 511 | return n; |
| 512 | } |
| 513 | |
| 514 | /* |
| 515 | * Insert a new allocation or reservation into the interval tree node `root`. |