From 577262a73757a1d1561935f4efebfd39e333391a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 22 Oct 2021 07:31:46 +0200 Subject: score: Add red-black tree append/prepend These functions are a faster alternative to _RBTree_Insert_inline() if it is known that the new node is the maximum/minimum node. Update #4531. --- cpukit/include/rtems/score/rbtreeimpl.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'cpukit/include') diff --git a/cpukit/include/rtems/score/rbtreeimpl.h b/cpukit/include/rtems/score/rbtreeimpl.h index 597c24d771..0867240d59 100644 --- a/cpukit/include/rtems/score/rbtreeimpl.h +++ b/cpukit/include/rtems/score/rbtreeimpl.h @@ -30,6 +30,32 @@ extern "C" { * @{ */ +/** + * @brief Appends the node to the red-black tree. + * + * The appended node is the new maximum node of the tree. The caller shall + * ensure that the appended node is indeed the maximum node with respect to the + * tree order. + * + * @param[in, out] the_rbtree is the red-black tree control. + * + * @param the_node[out] is the node to append. + */ +void _RBTree_Append( RBTree_Control *the_rbtree, RBTree_Node *the_node ); + +/** + * @brief Prepends the node to the red-black tree. + * + * The prepended node is the new minimum node of the tree. The caller shall + * ensure that the prepended node is indeed the minimum node with respect to the + * tree order. + * + * @param[in, out] the_rbtree is the red-black tree control. + * + * @param the_node[out] is the node to prepend. + */ +void _RBTree_Prepend( RBTree_Control *the_rbtree, RBTree_Node *the_node ); + /** * @brief Red-black tree visitor. * -- cgit v1.2.3