Changeset 0ef6e3bf in rtems
- Timestamp:
- 07/24/14 15:50:58 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 0b9fe3ec
- Parents:
- 993f5ac
- git-author:
- Sebastian Huber <sebastian.huber@…> (07/24/14 15:50:58)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (08/07/14 13:59:29)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/score/src/rbtreeextract.c
r993f5ac r0ef6e3bf 24 24 { 25 25 RBTree_Node *parent; 26 RBTree_Direction dir;27 26 28 27 parent = the_node->parent; … … 41 40 */ 42 41 if ( _RBTree_Is_red( sibling ) ) { 42 RBTree_Direction dir = _RBTree_Direction( the_node, parent ); 43 RBTree_Direction opp_dir = _RBTree_Opposite_direction( dir ); 44 43 45 parent->color = RBT_RED; 44 46 sibling->color = RBT_BLACK; 45 dir = the_node != parent->child[ 0 ];46 47 _RBTree_Rotate( parent, dir ); 47 sibling = parent->child[ _RBTree_Opposite_direction( dir )];48 sibling = parent->child[ opp_dir ]; 48 49 } 49 50 … … 67 68 * Then switch the sibling and parent colors, and rotate through parent. 68 69 */ 69 dir = the_node != parent->child[ 0 ]; 70 RBTree_Direction dir = _RBTree_Direction( the_node, parent ); 71 RBTree_Direction opp_dir = _RBTree_Opposite_direction( dir ); 70 72 71 73 if ( 72 !_RBTree_Is_red( sibling->child[ _RBTree_Opposite_direction( dir )] )74 !_RBTree_Is_red( sibling->child[ opp_dir ] ) 73 75 ) { 74 76 sibling->color = RBT_RED; 75 77 sibling->child[ dir ]->color = RBT_BLACK; 76 _RBTree_Rotate( sibling, _RBTree_Opposite_direction( dir ));77 sibling = parent->child[ _RBTree_Opposite_direction( dir )];78 _RBTree_Rotate( sibling, opp_dir ); 79 sibling = parent->child[ opp_dir ]; 78 80 } 79 81 80 82 sibling->color = parent->color; 81 83 parent->color = RBT_BLACK; 82 sibling->child[ _RBTree_Opposite_direction( dir )]->color = RBT_BLACK;84 sibling->child[ opp_dir ]->color = RBT_BLACK; 83 85 _RBTree_Rotate( parent, dir ); 84 86 break; /* done */
Note: See TracChangeset
for help on using the changeset viewer.