libsidplayfp 1.8.8
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#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#if RESID_BRANCH_HINTS && HAVE_BUILTIN_EXPECT
46#define likely(x) __builtin_expect(!!(x), 1)
47#define unlikely(x) __builtin_expect(!!(x), 0)
48#else
49#define likely(x) (x)
50#define unlikely(x) (x)
51#endif
52
53namespace reSID {
54
55// We could have used the smallest possible data type for each SID register,
56// however this would give a slower engine because of data type conversions.
57// An int is assumed to be at least 32 bits (necessary in the types reg24
58// and cycle_count). GNU does not support 16-bit machines
59// (GNU Coding Standards: Portability between CPUs), so this should be
60// a valid assumption.
61
62typedef unsigned int reg4;
63typedef unsigned int reg8;
64typedef unsigned int reg12;
65typedef unsigned int reg16;
66typedef unsigned int reg24;
67
68typedef int cycle_count;
69typedef short short_point[2];
70typedef double double_point[2];
71
72enum chip_model { MOS6581, MOS8580 };
73
74enum sampling_method { SAMPLE_FAST, SAMPLE_INTERPOLATE,
75 SAMPLE_RESAMPLE, SAMPLE_RESAMPLE_FASTMEM };
76
77} // namespace reSID
78
79extern "C"
80{
81#ifndef RESID_VERSION_CC
82extern const char* resid_version_string;
83#else
84const char* resid_version_string = "1.0-pre2";
85#endif
86}
87
88#endif // not RESID_SIDDEFS_H