Messages in this thread | | | Date | Thu, 12 Jul 2012 17:39:27 -0700 | Subject | Re: [PATCH 00/13] rbtree updates | From | Michel Lespinasse <> |
| |
On Thu, Jul 12, 2012 at 7:12 AM, Peter Zijlstra <peterz@infradead.org> wrote: > On Wed, 2012-07-11 at 18:12 -0700, Michel Lespinasse wrote: >> >> In __rb_erase_color(), some of the cases are more complicated than you drew however, because some node colors aren't known. > > Right, the wikipedia article draws them blank, I couldn't come up with a > 3rd case, although maybe we can annotate them like (P) to mean blank..
Ah, good idea, I adopted that :)
> Yes, very nice.. someday when I'm bored I might expand the comments with > the reason why we're doing the given operation.
There is a brief comment at the start of the loop that indicates which rbtree invariants might be violated at that point; so someone could deduce that we're trying to either fix these or move towards the root until they get fixed. But yeah, this is never explicitly explained.
> Also, I was sorely tempted to rename your tmp1,tmp2 variables to sl and > sr.
This could be done, but you'd *still* need one extra temporary, so you'd end up with sl, sr and tmp. Which is fine, I guess, but I preferred to have one less variable around.
-- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies.
| |