1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #ifndef ISC_LIKELY_H
13 #define ISC_LIKELY_H 1
14 
15 /*%
16  * Performance
17  */
18 #ifdef CPPCHECK
19 #define ISC_LIKELY(x)	(x)
20 #define ISC_UNLIKELY(x) (x)
21 #else /* ifdef CPPCHECK */
22 #ifdef HAVE_BUILTIN_EXPECT
23 #define ISC_LIKELY(x)	__builtin_expect(!!(x), 1)
24 #define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0)
25 #else /* ifdef HAVE_BUILTIN_EXPECT */
26 #define ISC_LIKELY(x)	(x)
27 #define ISC_UNLIKELY(x) (x)
28 #endif /* ifdef HAVE_BUILTIN_EXPECT */
29 #endif /* ifdef CPPCHECK */
30 
31 #endif /* ISC_LIKELY_H */
32