Fw: [PATCH 3/4] sys/tree.h: Add parent rotations

C Howland cc1964t@gmail.com
Tue Oct 5 14:56:37 GMT 2021


>
>
>
> ------------------------------
> *From:* Newlib <newlib-bounces+craig.howland=caci.com@sourceware.org> on
> behalf of Sebastian Huber <sebastian.huber@embedded-brains.de>
> *Sent:* Tuesday, October 5, 2021 10:16 AM
> *To:* newlib@sourceware.org <newlib@sourceware.org>
> *Cc:* devel@rtems.org <devel@rtems.org>
> *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
>
>


More information about the Newlib mailing list