projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewrite of likely, unlikely, barrier and ACCESS_ONCE
[urcu.git]
/
compiler.h
diff --git
a/compiler.h
b/compiler.h
index fb09ca2b9b238ceec418ba5c21c660b4cebcb7fd..717465c4d8570ce443e8cec4bb5b1abe3f3a0765 100644
(file)
--- a/
compiler.h
+++ b/
compiler.h
@@
-25,6
+25,11
@@
* IBM's contributions to this file may be relicensed under LGPLv2 or later.
*/
* IBM's contributions to this file may be relicensed under LGPLv2 or later.
*/
+#define likely() __builtin_expect(!!(x), 1)
+#define unlikely() __builtin_expect(!!(x), 0)
+
+#define barrier() asm volatile("" : : : "memory");
+
/*
* Instruct the compiler to perform only a single access to a variable
* (prohibits merging and refetching). The compiler is also forbidden to reorder
/*
* Instruct the compiler to perform only a single access to a variable
* (prohibits merging and refetching). The compiler is also forbidden to reorder
@@
-37,5
+42,6
@@
* use is to mediate communication between process-level code and irq/NMI
* handlers, all running on the same CPU.
*/
* 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)
#endif /* _COMPILER_H */
#endif /* _COMPILER_H */
This page took
0.023415 seconds
and
4
git commands to generate.