1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
7 * Branch Prediction Helpers in RTE
10 #ifndef _RTE_BRANCH_PREDICTION_H_
11 #define _RTE_BRANCH_PREDICTION_H_
18 * Check if a branch is likely to be taken.
20 * This compiler builtin allows the developer to indicate if a branch is
21 * likely to be taken. Example:
28 #define likely(x) __builtin_expect(!!(x), 1)
32 * Check if a branch is unlikely to be taken.
34 * This compiler builtin allows the developer to indicate if a branch is
35 * unlikely to be taken. Example:
37 * if (unlikely(x < 1))
42 #define unlikely(x) __builtin_expect(!!(x), 0)
49 #endif /* _RTE_BRANCH_PREDICTION_H_ */