[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: noverlay branch
From: |
Gerd Möllmann |
Subject: |
Re: noverlay branch |
Date: |
Thu, 29 Sep 2022 16:54:14 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 |
> What I'm less clear about is the use of the `null` sentinel node.
> It seems that this node is sometimes modified (e.g. its color changed
> from black to red or vice versa, and maybe also its `parent` field),
> even though it's pointed to from lots of different nodes, so any help
> documenting the way it works (or why the value in those fields doesn't
> matter) would be welcome.
Maybe I can say something because I used a similar trick in alloc.c.
The gist of that was to make searching more elegant, and faster:
static struct mem_node *
mem_find (void *start)
{
struct mem_node *p;
...
/* Make the search always successful to speed up the loop below. */
mem_z.start = start;
mem_z.end = (char *) start + 1;
p = mem_root;
while (start < p->start || start >= p->end)
p = start < p->start ? p->left : p->right;
return p;
}
If that's done for the same reason in itree.c, I don't know. A hint
that it is not, might be that each tree has a separated null node...
- Re: noverlay branch, (continued)
Re: noverlay branch, Matt Armstrong, 2022/09/27
Re: noverlay branch, Stefan Monnier, 2022/09/28
Re: noverlay branch, Gerd Möllmann, 2022/09/27