RTEMS Logo

RTEMS 4.6.99.3 On-Line Library


Priority Bitmap Manipulation Bit Scan Support

PREV UP NEXT Bookshelf RTEMS Porting Guide

8.5: Bit Scan Support

The _CPU_Priority_bits_index routine translates the bit numbers returned by _CPU_Bitfield_Find_first_bit() into something suitable for use as a major or minor component of a priority. The find first bit routine may number the bits in a way that is difficult to map into the major and minor components of the priority. For example, when finding the first bit set in the value 0x8000, a CPU may indicate that bit 15 or 16 is set based on whether the least significant bit is "zero" or "one". Similarly, a CPU may only scan 32-bit values and consider the most significant bit to be bit zero or one. In this case, this would be bit 16 or 17.

This routine allows that unwieldy form to be converted into a normalized form that is easier to process and use as an index.

#if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE)
#define _CPU_Priority_bits_index( _priority ) \
  (_priority)
#endif


PREV UP NEXT Bookshelf RTEMS Porting Guide

Copyright © 1988-2004 OAR Corporation