Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions portable/MSVC-MingW/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
#include "FreeRTOS.h"
#include "task.h"

#ifdef WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#else
#include <winsock.h>
#endif

#include <timeapi.h>

#ifdef __GNUC__
#include "mmsystem.h"
#else
Expand Down
18 changes: 5 additions & 13 deletions portable/MSVC-MingW/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@
#ifndef PORTMACRO_H
#define PORTMACRO_H

#ifdef WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#else
#include <winsock.h>
#endif

#include <windows.h>
#include <timeapi.h>
#include <mmsystem.h>
#include <winbase.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -156,22 +145,25 @@ void vPortExitCritical( void );
: "cc" )

#else /* __GNUC__ */
#include <intrin.h>

/* BitScanReverse returns the bit position of the most significant '1'
* in the word. */
#if defined( __x86_64__ ) || defined( _M_X64 )
#pragma intrinsic(_BitScanReverse64)

#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \
do \
{ \
DWORD ulTopPriority; \
unsigned long ulTopPriority; \
_BitScanReverse64( &ulTopPriority, ( uxReadyPriorities ) ); \
uxTopPriority = ulTopPriority; \
} while( 0 )

#else /* #if defined( __x86_64__ ) || defined( _M_X64 ) */
#pragma intrinsic(_BitScanReverse)

#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( unsigned long * ) &( uxTopPriority ), ( uxReadyPriorities ) )

#endif /* #if defined( __x86_64__ ) || defined( _M_X64 ) */

Expand Down
Loading