mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
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@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 lines
284 B
C
11 lines
284 B
C
#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)
|
|
|
|
#endif /* __MINIOS_COMPILER_H_ */
|