-
Notifications
You must be signed in to change notification settings - Fork 8
/
config.hpp.in
62 lines (44 loc) · 1.65 KB
/
config.hpp.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2019-2020 Francesco Biscani ([email protected])
//
// This file is part of the obake library.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef OBAKE_CONFIG_HPP
#define OBAKE_CONFIG_HPP
// Start of defines instantiated by CMake.
// clang-format off
#define OBAKE_VERSION_STRING "@obake_VERSION@"
#define OBAKE_VERSION_MAJOR @obake_VERSION_MAJOR@
#define OBAKE_VERSION_MINOR @obake_VERSION_MINOR@
#define OBAKE_VERSION_PATCH @obake_VERSION_PATCH@
@OBAKE_ENABLE_LIBBACKTRACE@
@OBAKE_STATIC_BUILD@
// clang-format on
// End of defines instantiated by CMake.
// Create a shortcut for detecting GCC.
// NOTE: clang defines __GNUC__ internally.
#if defined(__GNUC__) && !defined(__clang__)
#define OBAKE_COMPILER_IS_GCC
#endif
// Detect 128bit integers, lifted from mp++. This is part of the public API.
#include <mp++/config.hpp>
#if defined(MPPP_HAVE_GCC_INT128)
#define OBAKE_HAVE_GCC_INT128
#endif
// likely/unlikely macros, supported on GCC/clang.
#if defined(__GNUC__) || defined(__clang__)
#define obake_likely(x) __builtin_expect(static_cast<bool>(x), 1)
#define obake_unlikely(x) __builtin_expect(static_cast<bool>(x), 0)
#else
#define obake_likely(x) (x)
#define obake_unlikely(x) (x)
#endif
// For packing 64-bit values, we need 128-bit multiplication.
// This requires either 128-bit integer types, or compiler intrinsics.
// NOTE: _WIN64 should catch also 64-bit arm.
#if defined(OBAKE_HAVE_GCC_INT128) || (defined(_MSC_VER) && defined(_WIN64))
#define OBAKE_PACKABLE_INT64
#endif
#endif