Messages in this thread | ![/](/images/icornerl.gif) | | Date | Sat, 9 Aug 2003 01:21:17 +0100 | From | Jamie Lokier <> | Subject | Re: [PATCH] 2.4.22pre10: {,un}likely_p() macros for pointers |
| |
Albert Cahalan wrote: > // tell gcc what to expect: if(unlikely(err)) die(err); > #define likely(x) __builtin_expect(!!(x),1) > #define unlikely(x) __builtin_expect(!!(x),0) > #define expected(x,y) __builtin_expect((x),(y))
You may want to check that GCC generates the same code as for
#define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0)
I tried this once, and I don't recall the precise result but I do recall it generating different code (i.e. not optimal for one of the definitions).
-- Jamie - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |