From f8c94da9a13ed0cdc6f85b9665e2100186efee11 Mon Sep 17 00:00:00 2001 From: Radkesvat <134321679+radkesvat@users.noreply.github.com> Date: Sat, 3 Aug 2024 21:22:56 +0000 Subject: [PATCH] reformat and change max/min generic, test to fix macos build --- ww/utils/mathutils.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/ww/utils/mathutils.h b/ww/utils/mathutils.h index 229795a..ebda01d 100644 --- a/ww/utils/mathutils.h +++ b/ww/utils/mathutils.h @@ -18,9 +18,9 @@ unsigned long long: maxULL, \ unsigned long int: maxULInt, \ unsigned int: maxUInt, \ + signed long int: maxSLInt, \ int: maxInt, \ - double: maxDouble, \ - ssize_t: maxSsize)(a, b) + double: maxDouble)(a, b) static inline unsigned long long maxULL(unsigned long long a, unsigned long long b) { @@ -36,18 +36,20 @@ static inline unsigned int maxUInt(unsigned int a, unsigned int b) { return a > b ? a : b; } -static inline int maxInt(int a, int b) +static inline signed long int maxSLInt(signed long int a, signed long int b) { return a > b ? a : b; } -static inline double maxDouble(double a, double b) + +static inline int maxInt(int a, int b) { return a > b ? a : b; } -static inline ssize_t maxSsize(ssize_t a, ssize_t b) +static inline double maxDouble(double a, double b) { return a > b ? a : b; } + static inline long maxLong(long a, long b) { return a > b ? a : b; @@ -59,9 +61,9 @@ static inline long maxLong(long a, long b) unsigned long long: minULL, \ unsigned long int: minULInt, \ unsigned int: minUInt, \ + signed long int: minSLInt, \ int: minInt, \ - double: minDouble, \ - ssize_t: minSsize)(a, b) + double: minDouble)(a, b) static inline unsigned long long minULL(unsigned long long a, unsigned long long b) { @@ -70,7 +72,7 @@ static inline unsigned long long minULL(unsigned long long a, unsigned long long static inline unsigned long int minULInt(unsigned long int a, unsigned long int b) { - return a > b ? a : b; + return a < b ? a : b; } static inline unsigned int minUInt(unsigned int a, unsigned int b) @@ -78,18 +80,21 @@ static inline unsigned int minUInt(unsigned int a, unsigned int b) return a < b ? a : b; } -static inline int minInt(int a, int b) +static inline signed long int minSLInt(signed long int a, signed long int b) { return a < b ? a : b; } -static inline double minDouble(double a, double b) + +static inline int minInt(int a, int b) { return a < b ? a : b; } -static inline ssize_t minSsize(ssize_t a, ssize_t b) + +static inline double minDouble(double a, double b) { return a < b ? a : b; } + static inline long minLong(long a, long b) { return a < b ? a : b;