From 0c286e3d7c176a4fb7faf6ba9f809996d599ca10 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 25 Oct 2017 16:00:17 +0200 Subject: score: _Chain_Insert_ordered_unprotected() Change the chain order relation to use a directly specified left hand side value. This is similar to _RBTree_Insert_inline() and helps the compiler to better optimize the code. --- testsuites/sptests/spchain/init.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'testsuites') diff --git a/testsuites/sptests/spchain/init.c b/testsuites/sptests/spchain/init.c index 67bc3f53d0..51278d52f3 100644 --- a/testsuites/sptests/spchain/init.c +++ b/testsuites/sptests/spchain/init.c @@ -426,9 +426,14 @@ static void test_chain_node_count(void) } } -static bool test_order( const Chain_Node *left, const Chain_Node *right ) +static bool test_order( const void *left, const Chain_Node *right ) { - return left < right; + return (uintptr_t) left < (uintptr_t) right; +} + +static void insert_ordered( Chain_Control *chain, Chain_Node *node ) +{ + _Chain_Insert_ordered_unprotected( chain, node, node, test_order ); } static void test_chain_insert_ordered( void ) @@ -446,11 +451,11 @@ static void test_chain_insert_ordered( void ) _Chain_Initialize_node( &nodes[ i ] ); } - _Chain_Insert_ordered_unprotected( &chain, &nodes[4], test_order ); - _Chain_Insert_ordered_unprotected( &chain, &nodes[2], test_order ); - _Chain_Insert_ordered_unprotected( &chain, &nodes[0], test_order ); - _Chain_Insert_ordered_unprotected( &chain, &nodes[3], test_order ); - _Chain_Insert_ordered_unprotected( &chain, &nodes[1], test_order ); + insert_ordered( &chain, &nodes[4] ); + insert_ordered( &chain, &nodes[2] ); + insert_ordered( &chain, &nodes[0] ); + insert_ordered( &chain, &nodes[3] ); + insert_ordered( &chain, &nodes[1] ); tail = _Chain_Immutable_tail( &chain ); node = _Chain_Immutable_first( &chain ); -- cgit v1.2.3