[rtems commit] score: Define _Priority_Bits_index() once

Sebastian Huber sebh at rtems.org
Thu Jun 9 08:49:38 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jun  8 08:18:59 2016 +0200

score: Define _Priority_Bits_index() once

---

 .../score/include/rtems/score/prioritybitmapimpl.h | 38 ++++++++--------------
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/cpukit/score/include/rtems/score/prioritybitmapimpl.h b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
index fa37189..ac4c275 100644
--- a/cpukit/score/include/rtems/score/prioritybitmapimpl.h
+++ b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
@@ -93,19 +93,24 @@ RTEMS_INLINE_ROUTINE Priority_bit_map_Word _Priority_Mask(
 #endif
 }
 
-#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
 /**
- *  This method returns the bit index position for the specified priority.
- *
- *  @param[in] _priority is the priority for which we need the index.
+ * @brief Returns the bit index position for the specified major or minor bit
+ * number.
  *
- *  @retval This method returns the array index into the priority bit map.
+ * @param bit_number The bit number for which we need an index.
  *
- *  @note This may simply be a pass through to a CPU dependent implementation.
+ * @return The corresponding array index into the priority bit map.
  */
-#define _Priority_Bits_index( _priority ) \
-  _CPU_Priority_bits_index( _priority )
+RTEMS_INLINE_ROUTINE unsigned int _Priority_Bits_index(
+  unsigned int bit_number
+)
+{
+#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
+  return _CPU_Priority_bits_index( bit_number );
+#else
+  return bit_number;
 #endif
+}
 
 /**
  * This function returns the major portion of the_priority.
@@ -125,23 +130,6 @@ RTEMS_INLINE_ROUTINE unsigned int _Priority_Minor( unsigned int the_priority )
   return the_priority % 16;
 }
 
-#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE )
-
-/**
- * This function translates the bit numbers returned by the bit scan
- * of a priority bit field into something suitable for use as
- * a major or minor component of a priority.
- */
-
-RTEMS_INLINE_ROUTINE unsigned int _Priority_Bits_index(
-  unsigned int bit_number
-)
-{
-  return bit_number;
-}
-
-#endif
-
 RTEMS_INLINE_ROUTINE void _Priority_bit_map_Initialize(
   Priority_bit_map_Control *bit_map
 )



More information about the vc mailing list