From 5ce1c3c64db8e2468fbab8d9ba94ee7a805b6d0a Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 13 Sep 2011 13:27:38 -0700 Subject: [PATCH] lib: TYPE_IS_SIGNED macro generates compiler warnings. The TYPE_IS_SIGNED macro does a less than zero comparision with an unsigned type which can cause compiler warnings like the following: lib/tag.c:100:9: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] --- lib/type-props.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/type-props.h b/lib/type-props.h index 92250417..5c75d9f3 100644 --- a/lib/type-props.h +++ b/lib/type-props.h @@ -20,7 +20,7 @@ #include #define TYPE_IS_INTEGER(TYPE) ((TYPE) 1.5 == (TYPE) 1) -#define TYPE_IS_SIGNED(TYPE) ((TYPE) 0 > (TYPE) -1) +#define TYPE_IS_SIGNED(TYPE) ((TYPE) 1 > (TYPE) -1) #define TYPE_VALUE_BITS(TYPE) (sizeof(TYPE) * CHAR_BIT - TYPE_IS_SIGNED(TYPE)) #define TYPE_MINIMUM(TYPE) (TYPE_IS_SIGNED(TYPE) \ ? ~(TYPE)0 << TYPE_VALUE_BITS(TYPE) \ -- 2.30.2