libsidplayfp 1.0.3
siddefs.h
00001 //  ---------------------------------------------------------------------------
00002 //  This file is part of reSID, a MOS6581 SID emulator engine.
00003 //  Copyright (C) 2010  Dag Lem <resid@nimrod.no>
00004 //
00005 //  This program is free software; you can redistribute it and/or modify
00006 //  it under the terms of the GNU General Public License as published by
00007 //  the Free Software Foundation; either version 2 of the License, or
00008 //  (at your option) any later version.
00009 //
00010 //  This program is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //  GNU General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU General Public License
00016 //  along with this program; if not, write to the Free Software
00017 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //  ---------------------------------------------------------------------------
00019 
00020 #ifndef RESID_SIDDEFS_H
00021 #define RESID_SIDDEFS_H
00022 
00023 // Compilation configuration.
00024 #define RESID_INLINING 1
00025 #define RESID_INLINE inline
00026 #define RESID_BRANCH_HINTS 1
00027 
00028 // Compiler specifics.
00029 #define HAVE_BOOL 1
00030 #define HAVE_BUILTIN_EXPECT 1
00031 
00032 // Define bool, true, and false for C++ compilers that lack these keywords.
00033 #if !HAVE_BOOL
00034 typedef int bool;
00035 const bool true = 1;
00036 const bool false = 0;
00037 #endif
00038 
00039 // Branch prediction macros, lifted off the Linux kernel.
00040 #if RESID_BRANCH_HINTS && HAVE_BUILTIN_EXPECT
00041 #define likely(x)      __builtin_expect(!!(x), 1)
00042 #define unlikely(x)    __builtin_expect(!!(x), 0)
00043 #else
00044 #define likely(x)      (x)
00045 #define unlikely(x)    (x)
00046 #endif
00047 
00048 namespace reSID {
00049 
00050 // We could have used the smallest possible data type for each SID register,
00051 // however this would give a slower engine because of data type conversions.
00052 // An int is assumed to be at least 32 bits (necessary in the types reg24
00053 // and cycle_count). GNU does not support 16-bit machines
00054 // (GNU Coding Standards: Portability between CPUs), so this should be
00055 // a valid assumption.
00056 
00057 typedef unsigned int reg4;
00058 typedef unsigned int reg8;
00059 typedef unsigned int reg12;
00060 typedef unsigned int reg16;
00061 typedef unsigned int reg24;
00062 
00063 typedef int cycle_count;
00064 typedef short short_point[2];
00065 typedef double double_point[2];
00066 
00067 enum chip_model { MOS6581, MOS8580 };
00068 
00069 enum sampling_method { SAMPLE_FAST, SAMPLE_INTERPOLATE,
00070                        SAMPLE_RESAMPLE, SAMPLE_RESAMPLE_FASTMEM };
00071 
00072 } // namespace reSID
00073 
00074 extern "C"
00075 {
00076 #ifndef RESID_VERSION_CC
00077 extern const char* resid_version_string;
00078 #else
00079 const char* resid_version_string = "1.0-pre2";
00080 #endif
00081 }
00082 
00083 #endif // not RESID_SIDDEFS_H