OpenVPN 3 Core Library
Loading...
Searching...
No Matches
likely.hpp
Go to the documentation of this file.
1// OpenVPN -- An application to securely tunnel IP networks
2// over a single port, with support for SSL/TLS-based
3// session authentication and key exchange,
4// packet encryption, packet authentication, and
5// packet compression.
6//
7// Copyright (C) 2012- OpenVPN Inc.
8//
9// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10//
11
12#ifndef OPENVPN_COMMON_LIKELY_H
13#define OPENVPN_COMMON_LIKELY_H
14
15// Branch prediction hints (these make a difference on ARM)
16#if !defined(likely) && !defined(unlikely)
17#if defined(__GNUC__)
18#define likely(x) __builtin_expect((x), 1)
19#define unlikely(x) __builtin_expect((x), 0)
20#else
21#define likely(x) (x)
22#define unlikely(x) (x)
23#endif
24#endif
25
26#endif // OPENVPN_COMMON_LIKELY_H