X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;ds=sidebyside;f=compiler.h;h=717465c4d8570ce443e8cec4bb5b1abe3f3a0765;hb=2dc5fa0f7cfbfb0a64a7a67b39626650e863f16a;hp=2507ec88a0a6a6fbb11e84f73843bb042a9d850e;hpb=af02d47e5d0712e5ccde6d8f1ee89f18de798cad;p=urcu.git diff --git a/compiler.h b/compiler.h index 2507ec8..717465c 100644 --- a/compiler.h +++ b/compiler.h @@ -25,11 +25,10 @@ * IBM's contributions to this file may be relicensed under LGPLv2 or later. */ -/* The "volatile" is due to gcc bugs */ -#define barrier() __asm__ __volatile__("": : :"memory") +#define likely() __builtin_expect(!!(x), 1) +#define unlikely() __builtin_expect(!!(x), 0) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) +#define barrier() asm volatile("" : : : "memory"); /* * Instruct the compiler to perform only a single access to a variable @@ -43,6 +42,6 @@ * use is to mediate communication between process-level code and irq/NMI * handlers, all running on the same CPU. */ -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&x) #endif /* _COMPILER_H */