source: rtems/cpukit/score/src/rbtreenext.c @ 2afb22b

5
Last change on this file since 2afb22b was e9fbaa3b, checked in by Sebastian Huber <sebastian.huber@…>, on 08/21/15 at 03:59:49

rbtree: Replace implementation

Use the BSD <sys/tree.h> implementation since it is faster, more
flexible and uses less storage. See https://github.com/sebhub/rb-bench.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreRBTree
5 *
6 * @brief _RBTree_Next() and _RBTree_Next() implementation.
7 */
8
9/*
10 * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#if HAVE_CONFIG_H
24  #include "config.h"
25#endif
26
27#include <rtems/score/rbtreeimpl.h>
28#include <rtems/score/basedefs.h>
29
30RB_GENERATE_MINMAX( RBTree_Control, RBTree_Node, Node, static )
31
32RB_GENERATE_NEXT( RBTree_Control, RBTree_Node, Node, static )
33
34RB_GENERATE_PREV( RBTree_Control, RBTree_Node, Node, static )
35
36RBTree_Node *_RBTree_Minimum( const RBTree_Control *tree )
37{
38  return RB_MIN( RBTree_Control, RTEMS_DECONST( RBTree_Control *, tree ) );
39}
40
41RBTree_Node *_RBTree_Maximum( const RBTree_Control *tree )
42{
43  return RB_MAX( RBTree_Control, RTEMS_DECONST( RBTree_Control *, tree ) );
44}
45
46RBTree_Node *_RBTree_Successor( const RBTree_Node *node )
47{
48  return RB_NEXT( RBTree_Control, NULL, RTEMS_DECONST( RBTree_Node *, node ) );
49}
50
51RBTree_Node *_RBTree_Predecessor( const RBTree_Node *node )
52{
53  return RB_PREV( RBTree_Control, NULL, RTEMS_DECONST( RBTree_Node *, node ) );
54}
Note: See TracBrowser for help on using the repository browser.