1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

Fix compilation on macOS

This commit is contained in:
Sean Purcell
2017-04-13 12:33:45 -07:00
parent afa48518e2
commit f876f1200c
4 changed files with 15 additions and 5 deletions

View File

@ -569,7 +569,8 @@ UTIL_STATIC int UTIL_countPhysicalCores(void)
static S32 numPhysicalCores; /* apple specifies int32_t */
if (numPhysicalCores != 0) return numPhysicalCores;
{ int const ret = sysctlbyname("hw.physicalcpu", &numPhysicalCores, sizeof(int), NULL, 0);
{ size_t size = sizeof(S32);
int const ret = sysctlbyname("hw.physicalcpu", &numPhysicalCores, &size, NULL, 0);
if (ret != 0) {
if (errno == ENOENT) {
/* entry not present, fall back on 1 */