1
// Copyright (C) 2003 Dolphin Project.
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
15
// Official SVN repository and contact information can be found at
16
// http://code.google.com/p/dolphin-emu/
20
#include "base/compat.h"
21
#include "CommonTypes.h"
23
template <bool> struct CompileTimeAssert;
24
template<> struct CompileTimeAssert<true> {};
31
#if defined(_M_IX86) || defined(_M_X86)
32
#define Crash() {asm ("int $3");}
35
#define Crash() {kill(getpid(), SIGINT);}
38
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
40
inline u32 __rotl(u32 x, int shift) {
43
return (x << shift) | (x >> (32 - shift));
46
inline u64 __rotl64(u64 x, unsigned int shift){
47
unsigned int n = shift % 64;
48
return (x << n) | (x >> (64 - n));
51
inline u32 __rotr(u32 x, int shift) {
54
return (x >> shift) | (x << (32 - shift));
57
inline u64 __rotr64(u64 x, unsigned int shift){
58
unsigned int n = shift % 64;
59
return (x >> n) | (x << (64 - n));
64
// Function Cross-Compatibility
65
#define strcasecmp _stricmp
66
#define strncasecmp _strnicmp
67
#define unlink _unlink
69
#define __rotl64 _rotl64
71
#define __rotr64 _rotr64
73
// 64 bit offsets for windows
74
#define fseeko _fseeki64
75
#define ftello _ftelli64
77
#define fileno _fileno
80
#define Crash() {__asm int 3}
83
__declspec(dllimport) void __stdcall DebugBreak(void);
85
#define Crash() {DebugBreak();}
88
#define Crash() {DebugBreak();}
92
// Generic function to get last error message.
93
// Call directly after the command or use the error num.
94
// This function might change the error code.
95
// Defined in Misc.cpp.
96
const char *GetLastErrorMsg();
97
const char *GetStringErrorMsg(int errCode);