summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/chainimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-25 16:00:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-06 09:06:21 +0100
commit0c286e3d7c176a4fb7faf6ba9f809996d599ca10 (patch)
treebf30809e9a4f92d19254fa1acb1f833effa8dc40 /cpukit/score/include/rtems/score/chainimpl.h
parentscore: Remove superfluous include (diff)
downloadrtems-0c286e3d7c176a4fb7faf6ba9f809996d599ca10.tar.bz2
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.
Diffstat (limited to 'cpukit/score/include/rtems/score/chainimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/chainimpl.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/cpukit/score/include/rtems/score/chainimpl.h b/cpukit/score/include/rtems/score/chainimpl.h
index 21c0e6b026..c94c051198 100644
--- a/cpukit/score/include/rtems/score/chainimpl.h
+++ b/cpukit/score/include/rtems/score/chainimpl.h
@@ -830,14 +830,14 @@ RTEMS_INLINE_ROUTINE bool _Chain_Get_with_empty_check_unprotected(
/**
* @brief Chain node order.
*
- * @param[in] left The left node.
- * @param[in] right The right node.
+ * @param[in] left The left hand side.
+ * @param[in] right The right hand side.
*
* @retval true According to the order the left node precedes the right node.
* @retval false Otherwise.
*/
typedef bool ( *Chain_Node_order )(
- const Chain_Node *left,
+ const void *left,
const Chain_Node *right
);
@@ -848,20 +848,25 @@ typedef bool ( *Chain_Node_order )(
* relation holds for all nodes from the head up to the inserted node. Nodes
* after the inserted node are not moved.
*
- * @param[in,out] chain The chain.
- * @param[in,out] to_insert The node to insert.
+ * @param[in] the_chain The chain.
+ * @param[in] to_insert The node to insert.
+ * @param[in] left The left hand side passed to the order relation. It must
+ * correspond to the node to insert. The separate left hand side parameter
+ * may help the compiler to generate better code if it is stored in a local
+ * variable.
* @param[in] order The order relation.
*/
RTEMS_INLINE_ROUTINE void _Chain_Insert_ordered_unprotected(
- Chain_Control *chain,
- Chain_Node *to_insert,
- Chain_Node_order order
+ Chain_Control *the_chain,
+ Chain_Node *to_insert,
+ const void *left,
+ Chain_Node_order order
)
{
- const Chain_Node *tail = _Chain_Immutable_tail( chain );
- Chain_Node *next = _Chain_First( chain );
+ const Chain_Node *tail = _Chain_Immutable_tail( the_chain );
+ Chain_Node *next = _Chain_First( the_chain );
- while ( next != tail && !( *order )( to_insert, next ) ) {
+ while ( next != tail && !( *order )( left, next ) ) {
next = _Chain_Next( next );
}