]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix [un]likely(), add ptr support
authorAndrew Morton <akpm@osdl.org>
Thu, 14 Aug 2003 17:23:15 +0000 (10:23 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 14 Aug 2003 17:23:15 +0000 (10:23 -0700)
From: Albert Cahalan <albert@users.sourceforge.net>

1. allows likely() and unlikely() to work for pointers

2. fixes likely() (in C, any non-zero value is true)

include/linux/compiler.h

index 79e1773251f225b364c31f54826754f7b3d5a67b..356428f649fc9a356417f2018c32e89927079431 100644 (file)
@@ -24,8 +24,8 @@
 #define __builtin_expect(x, expected_value) (x)
 #endif
 
-#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)
 
 /*
  * Allow us to mark functions as 'deprecated' and have gcc emit a nice