libsidplayfp  1.2.1
builders/resid-builder/resid/siddefs.h
1 // ---------------------------------------------------------------------------
2 // This file is part of reSID, a MOS6581 SID emulator engine.
3 // Copyright (C) 2010 Dag Lem <resid@nimrod.no>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // ---------------------------------------------------------------------------
19 
20 #ifndef RESID_SIDDEFS_H
21 #define RESID_SIDDEFS_H
22 
23 // Compilation configuration.
24 #define RESID_INLINING 1
25 #define RESID_INLINE inline
26 #define RESID_BRANCH_HINTS 1
27 
28 // Compiler specifics.
29 #define HAVE_BOOL 1
30 #define HAVE_BUILTIN_EXPECT 1
31 
32 // Define bool, true, and false for C++ compilers that lack these keywords.
33 #if !HAVE_BOOL
34 typedef int bool;
35 const bool true = 1;
36 const bool false = 0;
37 #endif
38 
39 // Branch prediction macros, lifted off the Linux kernel.
40 #if RESID_BRANCH_HINTS && HAVE_BUILTIN_EXPECT
41 #define likely(x) __builtin_expect(!!(x), 1)
42 #define unlikely(x) __builtin_expect(!!(x), 0)
43 #else
44 #define likely(x) (x)
45 #define unlikely(x) (x)
46 #endif
47 
48 namespace reSID {
49 
50 // We could have used the smallest possible data type for each SID register,
51 // however this would give a slower engine because of data type conversions.
52 // An int is assumed to be at least 32 bits (necessary in the types reg24
53 // and cycle_count). GNU does not support 16-bit machines
54 // (GNU Coding Standards: Portability between CPUs), so this should be
55 // a valid assumption.
56 
57 typedef unsigned int reg4;
58 typedef unsigned int reg8;
59 typedef unsigned int reg12;
60 typedef unsigned int reg16;
61 typedef unsigned int reg24;
62 
63 typedef int cycle_count;
64 typedef short short_point[2];
65 typedef double double_point[2];
66 
67 enum chip_model { MOS6581, MOS8580 };
68 
69 enum sampling_method { SAMPLE_FAST, SAMPLE_INTERPOLATE,
70  SAMPLE_RESAMPLE, SAMPLE_RESAMPLE_FASTMEM };
71 
72 } // namespace reSID
73 
74 extern "C"
75 {
76 #ifndef RESID_VERSION_CC
77 extern const char* resid_version_string;
78 #else
79 const char* resid_version_string = "1.0-pre2";
80 #endif
81 }
82 
83 #endif // not RESID_SIDDEFS_H