Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/vbanext/sound_blargg.h
2 views
1
#ifndef SOUND_BLARGG_H
2
#define SOUND_BLARGG_H
3
4
/* Uncomment to have Gb_Apu run at 4x normal clock rate (16777216 Hz), useful in
5
a Game Boy Advance emulator. */
6
#define GB_APU_OVERCLOCK 4
7
8
#ifndef STATIC_CAST
9
#if __GNUC__ >= 4
10
#define STATIC_CAST(T,expr) static_cast<T> (expr)
11
#define CONST_CAST( T,expr) const_cast<T> (expr)
12
#else
13
#define STATIC_CAST(T,expr) ((T) (expr))
14
#define CONST_CAST( T,expr) ((T) (expr))
15
#endif
16
#endif
17
18
// BLARGG_COMPILER_HAS_BOOL: If 0, provides bool support for old compiler. If 1,
19
// compiler is assumed to support bool. If undefined, availability is determined.
20
#ifndef BLARGG_COMPILER_HAS_BOOL
21
#if defined (__MWERKS__)
22
#if !__option(bool)
23
#define BLARGG_COMPILER_HAS_BOOL 0
24
#endif
25
#elif defined (_MSC_VER)
26
#if _MSC_VER < 1100
27
#define BLARGG_COMPILER_HAS_BOOL 0
28
#endif
29
#elif defined (__GNUC__)
30
// supports bool
31
#elif __cplusplus < 199711
32
#define BLARGG_COMPILER_HAS_BOOL 0
33
#endif
34
#endif
35
#if defined (BLARGG_COMPILER_HAS_BOOL) && !BLARGG_COMPILER_HAS_BOOL
36
typedef int bool;
37
const bool true = 1;
38
const bool false = 0;
39
#endif
40
41
/* HAVE_STDINT_H: If defined, use <stdint.h> for int8_t etc.*/
42
#if defined (HAVE_STDINT_H)
43
#include <stdint.h>
44
/* HAVE_INTTYPES_H: If defined, use <stdint.h> for int8_t etc.*/
45
#elif defined (HAVE_INTTYPES_H)
46
#include <inttypes.h>
47
#endif
48
49
// If expr yields non-NULL error string, returns it from current function,
50
// otherwise continues normally.
51
#undef RETURN_ERR
52
#define RETURN_ERR( expr ) do { \
53
const char * blargg_return_err_ = (expr); \
54
if ( blargg_return_err_ ) return blargg_return_err_; \
55
} while ( 0 )
56
57
#endif // #ifndef SOUND_BLARGG_H
58
59