libresidfp 0.9.1
siddefs-fp.h
1/*
2 * This file is part of libsidplayfp, a SID player engine.
3 *
4 * Copyright 2011-2026 Leandro Nini <drfiemost@users.sourceforge.net>
5 * Copyright 2007-2010 Antti Lankila
6 * Copyright 1999 Dag Lem <resid@nimrod.no>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef SIDDEFS_FP_H
24#define SIDDEFS_FP_H
25
26// Check c++ standard
27#if __cplusplus >= 202302L
28# ifndef HAVE_CXX23
29# define HAVE_CXX23
30# endif
31#endif
32
33#if __cplusplus >= 202002L
34# ifndef HAVE_CXX20
35# define HAVE_CXX20
36# endif
37#endif
38
39#if __cplusplus >= 201703L
40# define LIKELY [[ likely ]]
41# define UNLIKELY [[ unlikely ]]
42# ifndef HAVE_CXX17
43# define HAVE_CXX17
44# endif
45#else
46# define LIKELY
47# define UNLIKELY
48#endif
49
50#if __cplusplus >= 201402L
51# define MAYBE_UNUSED [[ maybe_unused ]]
52# ifndef HAVE_CXX14
53# define HAVE_CXX14
54# endif
55#else
56# define MAYBE_UNUSED
57#endif
58
59#if __cplusplus >= 201103L
60# define MAKE_UNIQUE(type, ...) std::make_unique<type>(__VA_ARGS__)
61# ifndef HAVE_CXX11
62# define HAVE_CXX11
63# endif
64#else
65# define MAKE_UNIQUE(type, ...) std::unique_ptr<type>(new type(__VA_ARGS__))
66#endif
67
68#if __cplusplus < 201103L
69# error "This is not a C++11 compiler"
70#endif
71
72// Compilation configuration.
73#define RESIDFP_BRANCH_HINTS 1
74
75// Compiler specifics.
76#define HAVE_BUILTIN_EXPECT 1
77
78// Branch prediction macros, lifted off the Linux kernel.
79#if RESIDFP_BRANCH_HINTS && HAVE_BUILTIN_EXPECT
80# define likely(x) __builtin_expect(!!(x), 1)
81# define unlikely(x) __builtin_expect(!!(x), 0)
82#else
83# define likely(x) (x)
84# define unlikely(x) (x)
85#endif
86
87extern "C"
88{
89#ifndef __VERSION_CC__
90extern const char* residfp_version_string;
91#else
92const char* residfp_version_string = "0.9.1";
93#endif
94}
95
96// Inlining on/off.
97#define RESIDFP_INLINING 1
98#define RESIDFP_INLINE inline
99
100#endif // SIDDEFS_FP_H