From 6cb22b4818d155a5fde65fd4b06a2845f48a835e Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Thu, 17 Feb 2005 23:15:05 +0000 Subject: [PATCH] inew compatibility header from Ian Abbott --- include/linux/compiler.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/linux/compiler.h diff --git a/include/linux/compiler.h b/include/linux/compiler.h new file mode 100644 index 00000000..658110c5 --- /dev/null +++ b/include/linux/compiler.h @@ -0,0 +1,33 @@ +/* + * linux/compiler.h compatibility header + */ + +#ifndef _COMPAT_COMPILER_H +#define _COMPAT_COMPILER_H + +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) + +#include_next + +#else + +/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented + a mechanism by which the user can annotate likely branch directions and + expect the blocks to be reordered appropriately. Define __builtin_expect + to nothing for earlier compilers. */ + +#if __GNUC__ == 2 && __GNUC_MINOR__ < 96 +#define __builtin_expect(x, expected_value) (x) +#endif +#endif + +#ifndef likely +#define likely(x) __builtin_expect(!!(x),1) +#define unlikely(x) __builtin_expect(!!(x),0) +#endif + +#endif /* _COMPAT_COMPILER_H */ + + -- 2.26.2