mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
Fix compilation on windows
This commit is contained in:
@ -536,12 +536,16 @@ UTIL_STATIC int UTIL_countPhysicalCores(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) {
|
ptr = buffer;
|
||||||
ptr = buffer;
|
|
||||||
|
|
||||||
if (ptr->RelationShip == RelationProcessorCore) {
|
while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) {
|
||||||
|
|
||||||
|
if (ptr->Relationship == RelationProcessorCore) {
|
||||||
numPhysicalCores++;
|
numPhysicalCores++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptr++;
|
||||||
|
byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@ -551,10 +555,11 @@ UTIL_STATIC int UTIL_countPhysicalCores(void)
|
|||||||
|
|
||||||
failed:
|
failed:
|
||||||
/* try to fall back on GetSystemInfo */
|
/* try to fall back on GetSystemInfo */
|
||||||
SYSTEM_INFO sysinfo;
|
{ SYSTEM_INFO sysinfo;
|
||||||
GetSystemInfo(&sysinfo);
|
GetSystemInfo(&sysinfo);
|
||||||
numPhysicalCores = sysinfo.dwNumberOfProcessors;
|
numPhysicalCores = sysinfo.dwNumberOfProcessors;
|
||||||
if (numPhysicalCores == 0) numPhysicalCores = 1; /* just in case */
|
if (numPhysicalCores == 0) numPhysicalCores = 1; /* just in case */
|
||||||
|
}
|
||||||
return numPhysicalCores;
|
return numPhysicalCores;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user