MPMA Framework 0.4
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 //Luke Lenhart, 2007-2010 00026 //See /docs/License.txt for details on how this code may be used. 00027 00028 // -- platform implementations -- 00029 00030 #if defined(_WIN64) // msvc - 64 bit 00031 typedef unsigned __int64 nuint; 00032 typedef signed __int64 nsint; 00033 typedef unsigned char uint8; 00034 typedef signed char sint8; 00035 typedef unsigned short uint16; 00036 typedef signed short sint16; 00037 typedef unsigned int uint32; 00038 typedef signed int sint32; 00039 typedef unsigned __int64 uint64; 00040 typedef signed __int64 sint64; 00041 #define POINTER_SIZE sizeof(void*) 00042 #define THREAD_LOCAL __declspec(thread) 00043 #elif defined(_WIN32) // msvc - 32 bit 00044 typedef unsigned int nuint; 00045 typedef signed int nsint; 00046 typedef unsigned char uint8; 00047 typedef signed char sint8; 00048 typedef unsigned short uint16; 00049 typedef signed short sint16; 00050 typedef unsigned int uint32; 00051 typedef signed int sint32; 00052 typedef unsigned __int64 uint64; 00053 typedef signed __int64 sint64; 00054 #define POINTER_SIZE sizeof(void*) 00055 #define THREAD_LOCAL __declspec(thread) 00056 #elif defined(linux) && defined(__i386__) // g++ - 32 bit 00057 typedef unsigned int nuint; 00058 typedef signed int nsint; 00059 typedef unsigned char uint8; 00060 typedef signed char sint8; 00061 typedef unsigned short uint16; 00062 typedef signed short sint16; 00063 typedef unsigned int uint32; 00064 typedef signed int sint32; 00065 typedef unsigned long long uint64; 00066 typedef signed long long sint64; 00067 #define POINTER_SIZE sizeof(void*) 00068 #define THREAD_LOCAL __thread 00069 #elif defined(linux) && defined(__amd64__) // g++ - 64 bit 00070 typedef unsigned long long nuint; 00071 typedef signed long long nsint; 00072 typedef unsigned char uint8; 00073 typedef signed char sint8; 00074 typedef unsigned short uint16; 00075 typedef signed short sint16; 00076 typedef unsigned int uint32; 00077 typedef signed int sint32; 00078 typedef unsigned long long uint64; 00079 typedef signed long long sint64; 00080 #define POINTER_SIZE sizeof(void*) 00081 #define THREAD_LOCAL __thread 00082 #else 00083 #error Unknown platform in Types.h 00084 #endif 00085 00086 //Compile-time verification of sizes 00087 static_assert(sizeof(uint8)==1, "uint8 is defined incorrectly for the current platform"); 00088 static_assert(sizeof(sint8)==1, "sint8 is defined incorrectly for the current platform"); 00089 static_assert(sizeof(uint16)==2, "uint16 is defined incorrectly for the current platform"); 00090 static_assert(sizeof(sint16)==2, "sint16 is defined incorrectly for the current platform"); 00091 static_assert(sizeof(uint32)==4, "uint32 is defined incorrectly for the current platform"); 00092 static_assert(sizeof(sint32)==4, "sint32 is defined incorrectly for the current platform"); 00093 static_assert(sizeof(uint64)==8, "uint64 is defined incorrectly for the current platform"); 00094 static_assert(sizeof(sint64)==8, "sint64 is defined incorrectly for the current platform"); 00095 00096 static_assert(sizeof(nsint)==sizeof(nuint), "nsint and nuint are different sizes");