Just a friendly reminder that macros or inlines which include conditional expressions result in having to test every path of the branches everywhere they are inlined.
I doubt this one is a problem but we have to be aware that inlining complicated conditionals negatively impacts branch coverage testing. --joel On 3/31/2014 3:09 AM, Sebastian Huber wrote: > Module: rtems > Branch: master > Commit: 298d0fda9df75d2b7c4b9329a78845cb1398342b > Changeset: > http://git.rtems.org/rtems/commit/?id=298d0fda9df75d2b7c4b9329a78845cb1398342b > > Author: Sebastian Huber <sebastian.hu...@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; > +} > > /** @} */ > > > _______________________________________________ > rtems-vc mailing list > rtems...@rtems.org > http://www.rtems.org/mailman/listinfo/rtems-vc -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherr...@oarcorp.com On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available (256) 722-9985 _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel