VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
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#define HAVE_LOG1P 1
32
33// Define bool, true, and false for C++ compilers that lack these keywords.
34#if !HAVE_BOOL
35typedef int bool;
36const bool true = 1;
37const bool false = 0;
38#endif
39
40#if HAVE_LOG1P
41#define HAS_LOG1P
42#endif
43
44// Branch prediction macros, lifted off the Linux kernel.
45// #define likely(x) __builtin_expect(!!(x), 1)
46// #define unlikely(x) __builtin_expect(!!(x), 0)
47#ifndef likely
48#define likely(x) (x)
49#define unlikely(x) (x)
50#endif
51
52namespace reSID {
53
54// We could have used the smallest possible data type for each SID register,
55// however this would give a slower engine because of data type conversions.
56// An int is assumed to be at least 32 bits (necessary in the types reg24
57// and cycle_count). GNU does not support 16-bit machines
58// (GNU Coding Standards: Portability between CPUs), so this should be
59// a valid assumption.
60
61typedef unsigned int reg4;
62typedef unsigned int reg8;
63typedef unsigned int reg12;
64typedef unsigned int reg16;
65typedef unsigned int reg24;
66
67typedef int cycle_count;
68typedef short short_point[2];
69typedef double double_point[2];
70
71enum chip_model { MOS6581, MOS8580 };
72
73enum sampling_method {
74 SAMPLE_FAST,
75 SAMPLE_INTERPOLATE,
76 SAMPLE_RESAMPLE,
77 SAMPLE_RESAMPLE_FASTMEM
78};
79
80} // namespace reSID
81
82extern "C"
83{
84#ifndef RESID_VERSION_CC
85extern const char* resid_version_string;
86#else
87const char* resid_version_string = "VICE 3.2";
88#endif
89}
90
91#endif // not RESID_SIDDEFS_H