diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 4b70be9e801..33bc7321508 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -154,6 +154,11 @@ # define farcall_function __attribute__((long_call)) # endif +/* Branch prediction */ + +# define likely(x) __builtin_expect((x), 1) +# define unlikely(x) __builtin_expect((x), 0) + /* Code locate */ # define locate_code(n) __attribute__((section(n))) @@ -471,6 +476,8 @@ */ # define noreturn_function +# define likely(x) (x) +# define unlikely(x) (x) # define locate_code(n) # define aligned_data(n) # define locate_data(n) @@ -621,6 +628,8 @@ */ # define noreturn_function +# define likely(x) (x) +# define unlikely(x) (x) # define aligned_data(n) # define locate_code(n) # define locate_data(n) @@ -728,6 +737,8 @@ # define weak_const_function # define noreturn_function # define farcall_function +# define likely(x) (x) +# define unlikely(x) (x) # define locate_code(n) # define aligned_data(n) # define locate_data(n) @@ -815,6 +826,8 @@ # define restrict # define noreturn_function # define farcall_function +# define likely(x) (x) +# define unlikely(x) (x) # define aligned_data(n) # define locate_code(n) # define locate_data(n) @@ -877,6 +890,8 @@ # define restrict # define noreturn_function # define farcall_function +# define likely(x) (x) +# define unlikely(x) (x) # define aligned_data(n) # define locate_code(n) # define locate_data(n)