From: Alejandro Colomar Date: Thu, 27 Nov 2025 00:06:13 +0000 (+0100) Subject: lib/typetraits.h: Compact macros X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a00157d09c97420ba8ebcff321e2068ca276a9f;p=thirdparty%2Fshadow.git lib/typetraits.h: Compact macros Reviewed-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/lib/typetraits.h b/lib/typetraits.h index fb3d970d9..edb1c76d1 100644 --- a/lib/typetraits.h +++ b/lib/typetraits.h @@ -11,36 +11,12 @@ #include "sizeof.h" -#define is_unsigned(x) \ -( \ - (typeof(x)) -1 > 1 \ -) - -#define is_signed(x) \ -( \ - (typeof(x)) -1 < 1 \ -) - - -#define stype_max(T) \ -( \ - (T) (((((T) 1 << (WIDTHOF(T) - 2)) - 1) << 1) + 1) \ -) - -#define utype_max(T) \ -( \ - (T) -1 \ -) - -#define type_max(T) \ -( \ - (T) (is_signed(T) ? stype_max(T) : utype_max(T)) \ -) - -#define type_min(T) \ -( \ - (T) ~type_max(T) \ -) +# define is_unsigned(x) ((typeof(x)) -1 > 1) +# define is_signed(x) ((typeof(x)) -1 < 1) +# define stype_max(T) ((T) (((((T) 1 << (WIDTHOF(T) - 2)) - 1) << 1) + 1)) +# define utype_max(T) ((T) -1) +# define type_max(T) ((T) (is_signed(T) ? stype_max(T) : utype_max(T))) +# define type_min(T) ((T) ~type_max(T)) #define is_same_type(a, b) \