NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
types.h
1#pragma once
2
3#ifdef __cplusplus
4#include <cstdarg>
5#include <cstddef>
6#include <new>
7#else
8#include <stdarg.h>
9#include <stddef.h>
10#endif
11
12// Codewarrior-specific pragmas
13#ifdef __CWCC__
14#pragma cpp1x on
15#pragma gcc_extensions on
16#endif
17
18// Base types
19typedef unsigned char u8;
20typedef unsigned char byte_t;
21typedef unsigned short u16;
22typedef unsigned short byte2_t;
23typedef unsigned int u32;
24typedef unsigned int byte4_t;
25typedef unsigned long long u64;
26typedef signed char s8;
27typedef signed short s16;
28typedef signed int s32;
29typedef signed long long s64;
30typedef float f32;
31typedef double f64;
32typedef unsigned long ulong;
33typedef volatile s8 vs8;
34typedef volatile s16 vs16;
35typedef volatile s32 vs32;
36typedef volatile s64 vs64;
37typedef volatile u8 vu8;
38typedef volatile u16 vu16;
39typedef volatile u32 vu32;
40typedef volatile u64 vu64;
41typedef volatile f32 vf32;
42typedef volatile f64 vf64;
43
44typedef int UNKWORD;
45typedef void UNKTYPE;
46
47enum { FALSE, TRUE };
48typedef int BOOL;
49
50// Macros
51#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
52#define BIT_FLAG(bit) ((bit) < 0 ? 0 : 1 << (bit))
53#define ROUND_UP(x, align) (((x) + (align) - 1) & (-(align)))
54#define ROUND_UP_PTR(x, align) ((void*)((((u32)(x)) + (align) - 1) & (~((align) - 1))))
55
56// No-op on release
57#define EGG_ASSERT(...)
58#define EGG_ASSERT_MSG(...)
59
60#ifndef NULL
61#define NULL 0
62#endif // NULL
63
64#ifndef nullptr
65#define nullptr 0
66#endif // nullptr
67
68#define DECL_SECTION(x) __declspec(section x)
69#define DECL_WEAK __declspec(weak)
70#define ATTR_UNUSED
71
72#ifdef __CWCC__
73#define NOINLINE __attribute__((noinline))
74#define ALIGN(x) __attribute__((aligned(x)))
75#define DECOMP_INLINE inline
76#define DECOMP_DONT_INLINE __attribute__((never_inline))
77#define DONT_INLINE __attribute__((never_inline))
78#define AT_ADDRESS(x) : x
79#define override
80
81// Static assert
82#define GLUE(a, b) a##b
83#define GLUE2(a, b) GLUE(a, b)
84#define STATIC_ASSERT(cond) typedef char GLUE2(static_assertion_failed, __LINE__)[(cond) ? 1 : -1]
85#else
86#define NOINLINE
87#define ALIGN(x)
88#define DECOMP_INLINE
89#define DECOMP_DONT_INLINE
90#define DONT_INLINE
91#define AT_ADDRESS(x)
92#define STATIC_ASSERT(...)
93#endif