38#ifndef _RTEMS_SCORE_PRIORITYBITMAPIMPL_H
39#define _RTEMS_SCORE_PRIORITYBITMAPIMPL_H
75static inline unsigned int _Bitfield_Find_first_bit(
79 unsigned int bit_number;
81#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
82 _CPU_Bitfield_Find_first_bit( value, bit_number );
83#elif defined(__GNUC__)
84 bit_number = (
unsigned int) __builtin_clz( value )
85 - __SIZEOF_INT__ * __CHAR_BIT__ + 16;
87 if ( value < 0x100 ) {
105static inline Priority_bit_map_Word _Priority_Mask(
106 unsigned int bit_number
109#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
110 return _CPU_Priority_Mask( bit_number );
112 return (Priority_bit_map_Word) ( 0x8000u >> bit_number );
124static inline unsigned int _Priority_Bits_index(
125 unsigned int bit_number
128#if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
129 return _CPU_Priority_bits_index( bit_number );
142static inline unsigned int _Priority_Major(
unsigned int the_priority )
144 return the_priority / 16;
154static inline unsigned int _Priority_Minor(
unsigned int the_priority )
156 return the_priority % 16;
164static inline void _Priority_bit_map_Initialize(
168 memset( bit_map, 0,
sizeof( *bit_map ) );
179static inline void _Priority_bit_map_Add (
196static inline void _Priority_bit_map_Remove (
202 if ( *bit_map_info->
minor == 0 )
213static inline unsigned int _Priority_bit_map_Get_highest(
221 minor = _Bitfield_Find_first_bit( bit_map->
bit_map[ major ] );
223 return (_Priority_Bits_index( major ) << 4) +
224 _Priority_Bits_index( minor );
235static inline bool _Priority_bit_map_Is_empty(
251static inline void _Priority_bit_map_Initialize_information(
254 unsigned int new_priority
259 Priority_bit_map_Word mask;
261 major = _Priority_Major( new_priority );
262 minor = _Priority_Minor( new_priority );
264 bit_map_info->
minor = &bit_map->
bit_map[ _Priority_Bits_index( major ) ];
266 mask = _Priority_Mask( major );
268 bit_map_info->
block_major = (Priority_bit_map_Word) ~mask;
270 mask = _Priority_Mask( minor );
272 bit_map_info->
block_minor = (Priority_bit_map_Word) ~mask;
const unsigned char _Bitfield_Leading_zeros[256]
Definition: log2table.c:44
This header file provides interfaces of the Priority Bitmap which are used by the implementation and ...
Definition: prioritybitmap.h:60
Priority_bit_map_Word major_bit_map
Each sixteen bit entry in this word is associated with one of the sixteen entries in the bit map.
Definition: prioritybitmap.h:65
Priority_bit_map_Word bit_map[16]
Each bit in the bit map indicates whether or not there are threads ready at a particular priority.
Definition: prioritybitmap.h:75