From 97c2f2b35677f999ced3d8649bfc7d441b1dc4e4 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 23 Jul 2008 22:15:53 -0400 Subject: [PATCH] klibc/compiler.h: booleanize likely/unlikely __likely() and __unlikely() should explicitly booleanize their arguments. --- com32/include/klibc/compiler.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/com32/include/klibc/compiler.h b/com32/include/klibc/compiler.h index 9f5d36e2..984071f7 100644 --- a/com32/include/klibc/compiler.h +++ b/com32/include/klibc/compiler.h @@ -94,11 +94,11 @@ /* likely/unlikely */ #if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95)) -# define __likely(x) __builtin_expect((x), 1) -# define __unlikely(x) __builtin_expect((x), 0) +# define __likely(x) __builtin_expect(!!(x), 1) +# define __unlikely(x) __builtin_expect(!!(x), 0) #else -# define __likely(x) (x) -# define __unlikely(x) (x) +# define __likely(x) (!!(x)) +# define __unlikely(x) (!!(x)) #endif /* Possibly unused function */ -- 2.11.4.GIT