From bca86202a48b2afa527b6e40d8b360ce3bc7c2e7 Mon Sep 17 00:00:00 2001 From: caryclark Date: Wed, 19 Aug 2015 08:28:14 -0700 Subject: cast SK_ARRAY_COUNT to make it sign agnostic By adding a cast to SK_ARRAY_COUNT, the compiler treats the compile-time value as if it were a const int, and like regular numbers, permits it to be compared to signed and unsigned numbers freely. R=reed@google.com Review URL: https://codereview.chromium.org/1299943002 --- include/core/SkTypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 2e495117d8..fb1cceccc3 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -305,7 +305,7 @@ static inline bool SkIsU16(long x) { /** Returns the number of entries in an array (not a pointer) */ template char (&SkArrayCountHelper(T (&array)[N]))[N]; -#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array))) +#define SK_ARRAY_COUNT(array) ((int) sizeof(SkArrayCountHelper(array))) #define SkAlign2(x) (((x) + 1) >> 1 << 1) #define SkIsAlign2(x) (0 == ((x) & 1)) -- cgit v1.2.3