xref: /spdk/include/spdk/likely.h (revision da6841e4509a8eec7972dfe154ea9f13d09d9be1)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2016 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 /** \file
7  * Likely/unlikely branch prediction macros
8  */
9 
10 #ifndef SPDK_LIKELY_H
11 #define SPDK_LIKELY_H
12 
13 #include "spdk/stdinc.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #define spdk_unlikely(cond)	__builtin_expect((cond), 0)
20 #define spdk_likely(cond)	__builtin_expect(!!(cond), 1)
21 
22 #ifdef __cplusplus
23 }
24 #endif
25 
26 #endif
27