1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-07 04:10:08 +00:00

Fix for detection of number of CPU cores on Windows

This commit is contained in:
jules 2017-05-04 11:51:06 +01:00
parent a1794b1143
commit 0c24b48be8

View file

@ -99,10 +99,10 @@ static int findNumberOfPhysicalCores() noexcept
{
int numPhysicalCores = 0;
DWORD bufferSize = 0;
GetLogicalProcessorInformation (nullptr, &bufferSize);
if (GetLogicalProcessorInformation (nullptr, &bufferSize))
if (auto numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION)))
{
const size_t numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION));
HeapBlock<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> buffer (numBuffers);
if (GetLogicalProcessorInformation (buffer, &bufferSize))