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