Skip to content

Commit

Permalink
Merge pull request #570 from compnerd/slpi
Browse files Browse the repository at this point in the history
shims: correct the check for newer SLPI enumerators
  • Loading branch information
compnerd authored Sep 11, 2021
2 parents d6e4f7f + 8f0a012 commit 4fd4f40
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
link_directories(${DISPATCH_LIBDIR})

include(CheckCSourceCompiles)
check_c_source_compiles([=[
#include <Windows.h>
int main(int argc, char *argv[]) {
switch ((LOGICAL_PROCESSOR_RELATIONSHIP)0) {
case RelationProcessorDie:
case RelationNumaNodeEx:
return 0;
}
return 0;
}
]=] DISPATCH_HAVE_EXTENDED_SLPI_20348)
if(DISPATCH_HAVE_EXTENDED_SLPI_20348)
add_compile_definitions(DISPATCH_HAVE_EXTENDED_SLPI_20348)
endif()
endif()

set(CMAKE_C_STANDARD 11)
Expand Down
4 changes: 2 additions & 2 deletions src/shims/hw_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ _dispatch_hw_get_config(_dispatch_hw_config_t c)
++dwProcessorPhysicalCount;
dwProcessorLogicalCount += __popcnt64(slpiCurrent->ProcessorMask);
break;
#if defined(RelationProcessorDie)
#if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348)
case RelationProcessorDie:
#endif
case RelationProcessorPackage:
case RelationNumaNode:
#if defined(RelationNumaNodeEx)
#if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348)
case RelationNumaNodeEx:
#endif
case RelationCache:
Expand Down

0 comments on commit 4fd4f40

Please sign in to comment.