Changeset 69a6802b in rtems
- Timestamp:
- 06/17/16 05:50:01 (7 years ago)
- Branches:
- 5, master
- Children:
- 9bfad8c
- Parents:
- 768c483b
- git-author:
- Sebastian Huber <sebastian.huber@…> (06/17/16 05:50:01)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (06/22/16 12:37:11)
- Location:
- cpukit
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/sapi/Makefile.am
r768c483b r69a6802b 41 41 libsapi_a_SOURCES += src/delaynano.c 42 42 libsapi_a_SOURCES += src/rbtree.c 43 libsapi_a_SOURCES += src/rbtreefind.c 43 44 libsapi_a_SOURCES += src/rbtreeinsert.c 44 45 libsapi_a_SOURCES += src/profilingiterate.c -
cpukit/sapi/include/rtems/rbtree.h
r768c483b r69a6802b 56 56 57 57 /** 58 * @copydoc RBTree_Compare_result 59 */ 60 typedef RBTree_Compare_result rtems_rbtree_compare_result; 61 62 /** 63 * @copydoc RBTree_Compare 64 */ 65 typedef RBTree_Compare rtems_rbtree_compare; 58 * @brief Integer type for compare results. 59 * 60 * The type is large enough to represent pointers and 32-bit signed integers. 61 * 62 * @see rtems_rbtree_compare. 63 */ 64 typedef long rtems_rbtree_compare_result; 65 66 /** 67 * @brief Compares two red-black tree nodes. 68 * 69 * @param[in] first The first node. 70 * @param[in] second The second node. 71 * 72 * @retval positive The key value of the first node is greater than the one of 73 * the second node. 74 * @retval 0 The key value of the first node is equal to the one of the second 75 * node. 76 * @retval negative The key value of the first node is less than the one of the 77 * second node. 78 */ 79 typedef rtems_rbtree_compare_result ( *rtems_rbtree_compare )( 80 const RBTree_Node *first, 81 const RBTree_Node *second 82 ); 66 83 67 84 /** … … 256 273 } 257 274 258 /** 259 * @copydoc _RBTree_Find() 260 */ 261 RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find( 275 RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_equal( 276 rtems_rbtree_compare_result compare_result 277 ) 278 { 279 return compare_result == 0; 280 } 281 282 RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_greater( 283 rtems_rbtree_compare_result compare_result 284 ) 285 { 286 return compare_result > 0; 287 } 288 289 RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_lesser( 290 rtems_rbtree_compare_result compare_result 291 ) 292 { 293 return compare_result < 0; 294 } 295 296 /** 297 * @brief Tries to find a node for the specified key in the tree. 298 * 299 * @param[in] the_rbtree The red-black tree control. 300 * @param[in] the_node A node specifying the key. 301 * @param[in] compare The node compare function. 302 * @param[in] is_unique If true, then return the first node with a key equal to 303 * the one of the node specified if it exits, else return the last node if it 304 * exists. 305 * 306 * @retval node A node corresponding to the key. If the tree is not unique 307 * and contains duplicate keys, the set of duplicate keys acts as FIFO. 308 * @retval NULL No node exists in the tree for the key. 309 */ 310 rtems_rbtree_node* rtems_rbtree_find( 262 311 const rtems_rbtree_control *the_rbtree, 263 312 const rtems_rbtree_node *the_node, 264 rtems_rbtree_compare compare,313 rtems_rbtree_compare compare, 265 314 bool is_unique 266 ) 267 { 268 return _RBTree_Find( the_rbtree, the_node, compare, is_unique ); 269 } 315 ); 270 316 271 317 /** … … 397 443 RBTree_Control *the_rbtree, 398 444 RBTree_Node *the_node, 399 RBTree_Compare compare,445 rtems_rbtree_compare compare, 400 446 bool is_unique 401 447 ); -
cpukit/sapi/src/rbtreeinsert.c
r768c483b r69a6802b 15 15 16 16 RTEMS_STATIC_ASSERT( 17 sizeof( RBTree_Compare_result ) >= sizeof( intptr_t ),18 RBTree_Compare_result_intptr_t17 sizeof( rtems_rbtree_compare_result ) >= sizeof( intptr_t ), 18 rtems_rbtree_compare_result_intptr_t 19 19 ); 20 20 21 21 RTEMS_STATIC_ASSERT( 22 sizeof( RBTree_Compare_result ) >= sizeof( int32_t ),23 RBTree_Compare_result_int32_t22 sizeof( rtems_rbtree_compare_result ) >= sizeof( int32_t ), 23 rtems_rbtree_compare_result_int32_t 24 24 ); 25 25 … … 27 27 rtems_rbtree_control *the_rbtree, 28 28 rtems_rbtree_node *the_node, 29 RBTree_Comparecompare,29 rtems_rbtree_compare compare, 30 30 bool is_unique 31 31 ) … … 35 35 36 36 while ( *which != NULL ) { 37 RBTree_Compare_result compare_result;37 rtems_rbtree_compare_result compare_result; 38 38 39 39 parent = *which; 40 40 compare_result = ( *compare )( the_node, parent ); 41 41 42 if ( is_unique && _RBTree_Is_equal( compare_result ) ) {42 if ( is_unique && rtems_rbtree_is_equal( compare_result ) ) { 43 43 return parent; 44 44 } 45 45 46 if ( _RBTree_Is_lesser( compare_result ) ) {46 if ( rtems_rbtree_is_lesser( compare_result ) ) { 47 47 which = _RBTree_Left_reference( parent ); 48 48 } else { -
cpukit/score/Makefile.am
r768c483b r69a6802b 293 293 ## RBTREE_C_FILES 294 294 libscore_a_SOURCES += \ 295 src/rbtreeextract.c src/rbtreefind.c\295 src/rbtreeextract.c \ 296 296 src/rbtreeinsert.c src/rbtreeiterate.c src/rbtreenext.c 297 297 libscore_a_SOURCES += src/rbtreereplace.c -
cpukit/score/include/rtems/score/rbtree.h
r768c483b r69a6802b 58 58 59 59 /** 60 * @brief Integer type for compare results.61 *62 * The type is large enough to represent pointers and 32-bit signed integers.63 *64 * @see RBTree_Compare.65 */66 typedef long RBTree_Compare_result;67 68 /**69 * @brief Compares two red-black tree nodes.70 *71 * @param[in] first The first node.72 * @param[in] second The second node.73 *74 * @retval positive The key value of the first node is greater than the one of75 * the second node.76 * @retval 0 The key value of the first node is equal to the one of the second77 * node.78 * @retval negative The key value of the first node is less than the one of the79 * second node.80 */81 typedef RBTree_Compare_result ( *RBTree_Compare )(82 const RBTree_Node *first,83 const RBTree_Node *second84 );85 86 /**87 60 * @brief Initializer for an empty red-black tree with designator @a name. 88 61 */ … … 95 68 #define RBTREE_DEFINE_EMPTY( name ) \ 96 69 RBTree_Control name = RBTREE_INITIALIZER_EMPTY( name ) 97 98 /**99 * @brief Tries to find a node for the specified key in the tree.100 *101 * @param[in] the_rbtree The red-black tree control.102 * @param[in] the_node A node specifying the key.103 * @param[in] compare The node compare function.104 * @param[in] is_unique If true, then return the first node with a key equal to105 * the one of the node specified if it exits, else return the last node if it106 * exists.107 *108 * @retval node A node corresponding to the key. If the tree is not unique109 * and contains duplicate keys, the set of duplicate keys acts as FIFO.110 * @retval NULL No node exists in the tree for the key.111 */112 RBTree_Node *_RBTree_Find(113 const RBTree_Control *the_rbtree,114 const RBTree_Node *the_node,115 RBTree_Compare compare,116 bool is_unique117 );118 70 119 71 /** -
cpukit/score/include/rtems/score/rbtreeimpl.h
r768c483b r69a6802b 63 63 ); 64 64 65 RTEMS_INLINE_ROUTINE bool _RBTree_Is_equal(66 RBTree_Compare_result compare_result67 )68 {69 return compare_result == 0;70 }71 72 RTEMS_INLINE_ROUTINE bool _RBTree_Is_greater(73 RBTree_Compare_result compare_result74 )75 {76 return compare_result > 0;77 }78 79 RTEMS_INLINE_ROUTINE bool _RBTree_Is_lesser(80 RBTree_Compare_result compare_result81 )82 {83 return compare_result < 0;84 }85 86 65 /** @} */ 87 66
Note: See TracChangeset
for help on using the changeset viewer.