Skip to content

Commit 7992b41

Browse files
committed
More changes following review
1 parent a82697f commit 7992b41

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

portable/MSVC-MingW/portmacro.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,8 @@ void vPortExitCritical( void );
129129
#endif
130130

131131
/* 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 ) )
139134

140135
/*-----------------------------------------------------------*/
141136

@@ -148,10 +143,15 @@ void vPortExitCritical( void );
148143
/* BitScanReverse returns the bit position of the most significant '1'
149144
* in the word. */
150145
#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 )
152153
#else
153-
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
154-
154+
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
155155
#endif
156156

157157
#endif /* __GNUC__ */

0 commit comments

Comments
 (0)