diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-09-13 13:27:38 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-09-13 14:29:41 -0700 |
commit | 5ce1c3c64db8e2468fbab8d9ba94ee7a805b6d0a (patch) | |
tree | 7d6bb541fde111aca6221e9f86e5204f256d1507 | |
parent | 995337c4fc5f249965c52be52e852e5195ed2542 (diff) |
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]
-rw-r--r-- | lib/type-props.h | 2 |
1 files changed, 1 insertions, 1 deletions
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 <limits.h> #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) \ |