[rtems commit] score: Add _Scheduler_Highest_priority_of_two()

Sebastian Huber sebh at rtems.org
Mon Mar 31 08:09:15 UTC 2014


Module:    rtems
Branch:    master
Commit:    298d0fda9df75d2b7c4b9329a78845cb1398342b
Changeset: http://git.rtems.org/rtems/commit/?id=298d0fda9df75d2b7c4b9329a78845cb1398342b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar 24 07:44:00 2014 +0100

score: Add _Scheduler_Highest_priority_of_two()

Use inline functions instead of macros for
_Scheduler_Is_priority_lower_than() and
_Scheduler_Is_priority_higher_than().

---

 cpukit/score/include/rtems/score/schedulerimpl.h |   36 +++++++++++++++++----
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 7fbaf54..e70e466 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -269,18 +269,40 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
 }
 
 /**
- * Macro testing whether @a p1 has lower priority than @a p2
- * in the intuitive sense of priority.
+ * @brief Returns true if @p1 encodes a lower priority than @a p2 in the
+ * intuitive sense of priority.
  */
-#define _Scheduler_Is_priority_lower_than( _p1, _p2 ) \
-  (_Scheduler_Priority_compare(_p1,_p2) < 0)
+RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
+  Priority_Control p1,
+  Priority_Control p2
+)
+{
+  return _Scheduler_Priority_compare( p1,  p2 ) < 0;
+}
 
 /**
- * Macro testing whether @a p1 has higher priority than @a p2
+ * @brief Returns true if @p1 encodes a higher priority than @a p2 in the
+ * intuitive sense of priority.
+ */
+RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
+  Priority_Control p1,
+  Priority_Control p2
+)
+{
+  return _Scheduler_Priority_compare( p1,  p2 ) > 0;
+}
+
+/**
+ * @brief Returns the priority encoding @a p1 or @a p2 with the higher priority
  * in the intuitive sense of priority.
  */
-#define _Scheduler_Is_priority_higher_than( _p1, _p2 ) \
-  (_Scheduler_Priority_compare(_p1,_p2) > 0)
+RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
+  Priority_Control p1,
+  Priority_Control p2
+)
+{
+  return _Scheduler_Is_priority_higher_than( p1, p2 ) ? p1 : p2;
+}
 
 /** @} */
 




More information about the vc mailing list