Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/wonderswan/mednafen/types.h
2 views
1
#ifndef __MDFN_TYPES
2
#define __MDFN_TYPES
3
4
#define __STDC_LIMIT_MACROS 1
5
6
// Make sure this file is included BEFORE a few common standard C header files(stdio.h, errno.h, math.h, AND OTHERS, but this is not an exhaustive check, nor
7
// should it be), so that any defines in config.h that change header file behavior will work properly.
8
#if defined(EOF) || defined(EACCES) || defined(F_LOCK) || defined(NULL) || defined(O_APPEND) || defined(M_LOG2E)
9
#error "Wrong include order for types.h"
10
#endif
11
12
// Yes, yes, I know: There's a better place for including config.h than here, but I'm tired, and this should work fine. :b
13
#ifdef HAVE_CONFIG_H
14
#include <config.h>
15
#endif
16
17
#include <assert.h>
18
#include <inttypes.h>
19
20
typedef int8_t int8;
21
typedef int16_t int16;
22
typedef int32_t int32;
23
typedef int64_t int64;
24
25
typedef uint8_t uint8;
26
typedef uint16_t uint16;
27
typedef uint32_t uint32;
28
typedef uint64_t uint64;
29
30
typedef struct
31
{
32
union
33
{
34
struct
35
{
36
#ifdef MSB_FIRST
37
uint8 High;
38
uint8 Low;
39
#else
40
uint8 Low;
41
uint8 High;
42
#endif
43
} Union8;
44
uint16 Val16;
45
};
46
} Uuint16;
47
48
typedef struct
49
{
50
union
51
{
52
struct
53
{
54
#ifdef MSB_FIRST
55
Uuint16 High;
56
Uuint16 Low;
57
#else
58
Uuint16 Low;
59
Uuint16 High;
60
#endif
61
} Union16;
62
uint32 Val32;
63
};
64
} Uuint32;
65
66
67
#if PSS_STYLE==2
68
69
#define PSS "\\"
70
#define MDFN_PS '\\'
71
72
#elif PSS_STYLE==1
73
74
#define PSS "/"
75
#define MDFN_PS '/'
76
77
#elif PSS_STYLE==3
78
79
#define PSS "\\"
80
#define MDFN_PS '\\'
81
82
#elif PSS_STYLE==4
83
84
#define PSS ":"
85
#define MDFN_PS ':'
86
87
#endif
88
89
typedef uint32 UTF32; /* at least 32 bits */
90
typedef uint16 UTF16; /* at least 16 bits */
91
typedef uint8 UTF8; /* typically 8 bits */
92
typedef unsigned char Boolean; /* 0 or 1 */
93
94
#ifndef FALSE
95
#define FALSE 0
96
#endif
97
98
#ifndef TRUE
99
#define TRUE 1
100
#endif
101
102
#undef require
103
#define require( expr ) assert( expr )
104
105
#if !defined(MSB_FIRST) && !defined(LSB_FIRST)
106
#error "Define MSB_FIRST or LSB_FIRST!"
107
#endif
108
109
//#include "error.h"
110
111
#endif
112
113