[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] minios: fix incorrect {, un}likely() definitions
commit 7915fc1587eb61c64499d025e52ab1c665be44d7 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Jul 2 14:46:42 2014 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Jul 2 14:46:42 2014 +0200 minios: fix incorrect {, un}likely() definitions As identified in e5545fb6, likely() and unlikely() must convert their expressions to booleans before comparing to 1 or 0, to avoid truncation issues. While editing this file, add inclusion guards. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> --- extras/mini-os/include/compiler.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/extras/mini-os/include/compiler.h b/extras/mini-os/include/compiler.h index e35c9d5..4188277 100644 --- a/extras/mini-os/include/compiler.h +++ b/extras/mini-os/include/compiler.h @@ -1,5 +1,10 @@ +#ifndef __MINIOS_COMPILER_H_ +#define __MINIOS_COMPILER_H_ + #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 #define __builtin_expect(x, expected_value) (x) #endif -#define unlikely(x) __builtin_expect((x),0) -#define likely(x) __builtin_expect((x),1) +#define unlikely(x) __builtin_expect(!!(x),0) +#define likely(x) __builtin_expect(!!(x),1) + +#endif /* __MINIOS_COMPILER_H_ */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |