@@ -129,13 +129,8 @@ void vPortExitCritical( void );
129
129
#endif
130
130
131
131
/* Store/clear the ready priorities in a bit map. */
132
- #if defined( __x86_64__ ) || defined( _M_X64 )
133
- #define portRECORD_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1ULL << ( uxPriority ) )
134
- #define portRESET_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1ULL << ( uxPriority ) )
135
- #else
136
- #define portRECORD_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
137
- #define portRESET_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
138
- #endif
132
+ #define portRECORD_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) |= ( ( ( UBaseType_t ) 1 ) << ( uxPriority ) )
133
+ #define portRESET_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) &= ~( ( ( UBaseType_t ) 1 ) << ( uxPriority ) )
139
134
140
135
/*-----------------------------------------------------------*/
141
136
@@ -148,10 +143,15 @@ void vPortExitCritical( void );
148
143
/* BitScanReverse returns the bit position of the most significant '1'
149
144
* in the word. */
150
145
#if defined( __x86_64__ ) || defined( _M_X64 )
151
- #define portGET_HIGHEST_PRIORITY ( uxTopPriority , uxReadyPriorities ) uxTopPriority = 0; _BitScanReverse64( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
146
+ #define portGET_HIGHEST_PRIORITY ( uxTopPriority , uxReadyPriorities ) \
147
+ do \
148
+ { \
149
+ DWORD ulTopPriority; \
150
+ _BitScanReverse64( &ulTopPriority, ( uxReadyPriorities ) ); \
151
+ uxTopPriority = ulTopPriority; \
152
+ } while( 0 )
152
153
#else
153
- #define portGET_HIGHEST_PRIORITY ( uxTopPriority , uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
154
-
154
+ #define portGET_HIGHEST_PRIORITY ( uxTopPriority , uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
155
155
#endif
156
156
157
157
#endif /* __GNUC__ */
0 commit comments