1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - - types definition 3 File: types.h 4 5 Copyright 2003-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: 2008-09-17#$ 14 $Rev: 8556 $ 15 $Author: okubata_ryoma $ 16 *---------------------------------------------------------------------------*/ 17 #ifndef NITRO_TYPES_H_ 18 #define NITRO_TYPES_H_ 19 20 // Because the SDK will not operate correctly if enum is not the same size as the int type 21 #ifdef __MWERKS__ 22 #pragma enumsalwaysint on 23 #endif 24 25 // Endian 26 #define SDK_LITTLE_ENDIAN 27 #define SDK_IS_LITTLE_ENDIAN 1 28 #define SDK_IS_BIG_ENDIAN 0 29 30 #ifdef SDK_ASM 31 #else //SDK_ASM 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 typedef unsigned char u8; 38 typedef unsigned short int u16; 39 typedef unsigned long u32; 40 41 #ifdef SDK_HAS_NO_LONG_LONG_INT_ 42 typedef unsigned __int64 u64; 43 #else 44 typedef unsigned long long int u64; 45 #endif 46 47 typedef signed char s8; 48 typedef signed short int s16; 49 typedef signed long s32; 50 51 #ifdef SDK_HAS_NO_LONG_LONG_INT_ 52 typedef signed __int64 s64; 53 #else 54 typedef signed long long int s64; 55 #endif 56 57 typedef volatile u8 vu8; 58 typedef volatile u16 vu16; 59 typedef volatile u32 vu32; 60 typedef volatile u64 vu64; 61 62 typedef volatile s8 vs8; 63 typedef volatile s16 vs16; 64 typedef volatile s32 vs32; 65 typedef volatile s64 vs64; 66 67 typedef float f32; 68 typedef volatile f32 vf32; 69 70 /* 71 Macro and types used with io_register_list_XX.h 72 */ 73 74 typedef u8 REGType8; 75 typedef u16 REGType16; 76 typedef u32 REGType32; 77 typedef u64 REGType64; 78 79 typedef vu8 REGType8v; 80 typedef vu16 REGType16v; 81 typedef vu32 REGType32v; 82 typedef vu64 REGType64v; 83 84 85 #ifndef SDK_BOOL_ALREADY_DEFINED_ 86 #ifndef BOOL 87 typedef int BOOL; 88 #endif //BOOL 89 #endif //SDK_ALREADY_DEFINE_BOOL_ 90 91 #ifndef TRUE 92 // Any non-zero value is considered TRUE 93 #define TRUE 1 94 #endif //TRUE 95 96 #ifndef FALSE 97 #define FALSE 0 98 #endif // FALSE 99 100 101 #ifndef NULL 102 #ifdef __cplusplus 103 #define NULL 0 104 #else // __cplusplus 105 #define NULL ((void *)0) 106 #endif // __cplusplus 107 #endif // NULL 108 109 // For compatibility with GameCube 110 #if defined(SDK_CW) || defined(SDK_RX) || defined(__MWERKS__) 111 #ifndef ATTRIBUTE_ALIGN 112 #define ATTRIBUTE_ALIGN(num) __attribute__ ((aligned(num))) 113 #endif 114 #endif 115 116 // Weak symbol 117 #if defined(SDK_CW) || defined(SDK_RX) || defined(__MWERKS__) 118 #define SDK_WEAK_SYMBOL __declspec(weak) 119 #elif defined(SDK_PRODG) 120 #define SDK_WEAK_SYMBOL 121 #endif 122 123 /* Option for the compiler that deals with dead-stripping */ 124 #ifdef SDK_CW_FORCE_EXPORT_SUPPORT 125 #define SDK_FORCE_EXPORT __declspec(force_export) 126 #else 127 #define SDK_FORCE_EXPORT 128 #endif 129 130 #ifdef __cplusplus 131 } /* extern "C" */ 132 #endif 133 #endif //SDK_ASM 134 135 136 /* When you want to make static inline into inline and reduce the code size, change the SDK_INLINE macro. 137 (When there is a declaration that makes static inline into inline, also change SDK_DECL_INLINE.) 138 Rebuild the library if changes are made. 139 140 However, using a version of the compiler in which the inline function instantiation bug has been fixed, code size can be reduced if this macro is used to change static inline to inline only in functions where static was changed to static inline to avoid the bug. 141 142 143 144 Note: These macros are currently valid with only the FX_, VEC_, and MTX_ series.*/ 145 #define SDK_INLINE static inline 146 #define SDK_DECL_INLINE static 147 148 149 /* NITRO_TYPES_H_ */ 150 #endif 151