libresidfp  1.2.3
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 # define MAYBE_UNUSED [[ maybe_unused ]]
43 # ifndef HAVE_CXX17
44 # define HAVE_CXX17
45 # endif
46 #else
47 # define LIKELY
48 # define UNLIKELY
49 # define MAYBE_UNUSED
50 #endif
51 
52 #if __cplusplus >= 201402L
53 # ifndef HAVE_CXX14
54 # define HAVE_CXX14
55 # endif
56 #endif
57 
58 #if __cplusplus >= 201103L
59 # define MAKE_UNIQUE(type, ...) std::make_unique<type>(__VA_ARGS__)
60 # ifndef HAVE_CXX11
61 # define HAVE_CXX11
62 # endif
63 #else
64 # define MAKE_UNIQUE(type, ...) std::unique_ptr<type>(new type(__VA_ARGS__))
65 #endif
66 
67 #if __cplusplus < 201103L
68 # error "This is not a C++11 compiler"
69 #endif
70 
71 // Compilation configuration.
72 #define RESIDFP_BRANCH_HINTS 1
73 
74 // Compiler specifics.
75 #define HAVE_BUILTIN_EXPECT 1
76 
77 // Branch prediction macros, lifted off the Linux kernel.
78 #if RESIDFP_BRANCH_HINTS && HAVE_BUILTIN_EXPECT
79 # define likely(x) __builtin_expect(!!(x), 1)
80 # define unlikely(x) __builtin_expect(!!(x), 0)
81 #else
82 # define likely(x) (x)
83 # define unlikely(x) (x)
84 #endif
85 
86 extern "C"
87 {
88 #ifndef __VERSION_CC__
89 extern const char* residfp_version_string;
90 #else
91 const char* residfp_version_string = "1.2.3";
92 #endif
93 }
94 
95 // Inlining on/off.
96 #define RESIDFP_INLINING 1
97 #define RESIDFP_INLINE inline
98 
99 #endif // SIDDEFS_FP_H