Re: Fw: [PATCH 3/4] sys/tree.h: Add parent rotations
C Howland <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CANk6obQrgkNyqDtaPK48HyC7Bhk1Xb6sKb6Q+Fz=QBw0Myncrw@mail.gmail.com> |
> > > > ------------------------------ > *From:* Newlib <[email protected]> on > behalf of Sebastian Huber <[email protected]> > *Sent:* Tuesday, October 5, 2021 10:16 AM > *To:* [email protected] <[email protected]> > *Cc:* [email protected] <[email protected]> > *Subject:* [PATCH 3/4] sys/tree.h: Add parent rotations > > > > Add specialized rotations RB_PARENT_ROTATE_LEFT() and > RB_PARENT_ROTATE_RIGHT() > which may be used if the parent node exists and the direction of the child > is > known. The specialized rotations are derived from RB_ROTATE_LEFT() and > RB_ROTATE_RIGHT() where the RB_SWAP_CHILD() was replaced by a simple > assignment. > It would seem appropriate for both this patch and #4 to include your descriptions from the emails about the specialized nature of these new macros in the source. (Otherwise, how can the conditions on their use be known?) Craig --- > newlib/libc/include/sys/tree.h | 36 ++++++++++++++++++++++++++++++---- > 1 file changed, 32 insertions(+), 4 deletions(-) > > diff --git a/newlib/libc/include/sys/tree.h > b/newlib/libc/include/sys/tree.h > index 180809e9b..5fc052817 100644 > --- a/newlib/libc/include/sys/tree.h > +++ b/newlib/libc/include/sys/tree.h > @@ -381,6 +381,30 @@ struct > { \ > RB_AUGMENT(elm); \ > } while (/*CONSTCOND*/ 0) > > +#define RB_PARENT_ROTATE_LEFT(parent, left, tmp, field) do { \ > ... > 2.26.2 > >