diff --git a/programs/bench.c b/programs/bench.c index d25ff8f0..8d8ed4ff 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -146,8 +146,13 @@ typedef struct { } blockParam_t; -#define MIN(a,b) ((a)<(b) ? (a) : (b)) -#define MAX(a,b) ((a)>(b) ? (a) : (b)) + +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif +#ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif static int BMK_benchMem(const void* srcBuffer, size_t srcSize, const char* displayName, int cLevel, diff --git a/programs/dibio.c b/programs/dibio.c index b7ed280e..5e685a32 100644 --- a/programs/dibio.c +++ b/programs/dibio.c @@ -89,7 +89,9 @@ unsigned DiB_isError(size_t errorCode) { return ERR_isError(errorCode); } const char* DiB_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); } -#define MIN(a,b) ( (a) < (b) ? (a) : (b) ) +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif /* ******************************************************** diff --git a/programs/fileio.c b/programs/fileio.c index f1f5a557..1dc222b6 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -96,7 +96,9 @@ void FIO_setNotificationLevel(unsigned level) { g_displayLevel=level; } static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100; static clock_t g_time = 0; -#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif /* ************************************************************ * Avoid fseek()'s 2GiB barrier with MSVC, MacOS, *BSD, MinGW diff --git a/programs/util.h b/programs/util.h index 0b90cda1..104f8dad 100644 --- a/programs/util.h +++ b/programs/util.h @@ -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 */