-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.h
74 lines (60 loc) · 1.52 KB
/
types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include "config.h"
#define ATTR_HOT __attribute__((hot))
//#define ATTR_FORCE_INLINE __attribute__((always_inline))
#define ATTR_FORCE_INLINE
//#define ATTR_FORCE_NOINLINE __attribute__((noinline))
#define ATTR_FORCE_NOINLINE
//#define COMPILER_VARIABLE_BARRIER(var) (void)(var)
#define COMPILER_VARIABLE_BARRIER(var) __asm volatile(""::"r"(var))
//#define COMPILER_MEMORY_BARRIER()
#define COMPILER_MEMORY_BARRIER() __asm volatile("":::"memory")
//#define COMPILER_UNLIKELY(cond) cond
#define COMPILER_UNLIKELY(cond) __builtin_expect(cond, 0)
//#define COMPILER_LIKELY(cond) cond
#define COMPILER_LIKELY(cond) __builtin_expect(cond, 1)
#ifndef NULL
#define NULL ((void*)0)
#endif
#ifndef count_of
#define count_of(h) (sizeof(h)/sizeof((h)[0]))
#endif
#if PPU_IS_MONOCHROME
typedef unsigned char pixel_t;
#elif PPU_MODE == 4
typedef unsigned char pixel_t;
#elif PPU_MODE == 6
typedef unsigned short pixel_t;
#else
typedef unsigned int pixel_t;
#endif
typedef unsigned int word;
typedef signed int sword;
#if !GBA
typedef unsigned int var;
typedef signed int svar;
#else
//typedef unsigned short var;
//typedef signed short svar;
typedef unsigned int var;
typedef signed int svar;
#endif
typedef word wbool;
typedef var vbool;
typedef unsigned char r8;
typedef unsigned short r16;
typedef unsigned long int r32;
typedef signed short s16;
typedef signed long int s32;
struct hilow16_t
{
union
{
struct
{
r8 low, high;
};
r16 raw;
};
};
typedef struct hilow16_t hilow16_t;