Commit 2e0623e3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix [un]likely(), add ptr support

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)
parent ca5c021c
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#define __builtin_expect(x, expected_value) (x) #define __builtin_expect(x, expected_value) (x)
#endif #endif
#define likely(x) __builtin_expect((x),1) #define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect((x),0) #define unlikely(x) __builtin_expect(!!(x), 0)
/* /*
* Allow us to mark functions as 'deprecated' and have gcc emit a nice * Allow us to mark functions as 'deprecated' and have gcc emit a nice
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment