|
46 | 46 | #define Crash() {kill(getpid(), SIGINT);}
|
47 | 47 | #endif
|
48 | 48 |
|
| 49 | +#else // WIN32 |
| 50 | + |
| 51 | +// Function Cross-Compatibility |
| 52 | +#ifndef __MINGW32__ |
| 53 | + #define strcasecmp _stricmp |
| 54 | + #define strncasecmp _strnicmp |
| 55 | +#endif |
| 56 | + |
| 57 | +#ifndef __MINGW32__ |
| 58 | +#define unlink _unlink |
| 59 | +#endif |
| 60 | + |
| 61 | +// 64 bit offsets for windows |
| 62 | +#ifndef __MINGW32__ |
| 63 | + #define fseeko _fseeki64 |
| 64 | + #define ftello _ftelli64 |
| 65 | + #define atoll _atoi64 |
| 66 | +#endif |
| 67 | + #define Crash() {__debugbreak();} |
| 68 | +#endif // WIN32 ndef |
| 69 | + |
| 70 | +#if defined(_MSC_VER) |
| 71 | +#include <cstdlib> |
| 72 | +#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) |
| 73 | +#include <x86intrin.h> |
| 74 | +#endif |
| 75 | + |
49 | 76 | inline u32 __rotl(u32 x, int shift) {
|
| 77 | +#if defined(_MSC_VER) |
| 78 | + return _rotl(x, shift); |
| 79 | +#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) |
| 80 | + return __rold(x, shift); |
| 81 | +#else |
50 | 82 | shift &= 31;
|
51 | 83 | if (!shift) return x;
|
52 | 84 | return (x << shift) | (x >> (32 - shift));
|
| 85 | +#endif |
53 | 86 | }
|
54 | 87 |
|
55 | 88 | inline u64 __rotl64(u64 x, unsigned int shift){
|
| 89 | +#if defined(_MSC_VER) |
| 90 | + return _rotl64(x, shift); |
| 91 | +#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) |
| 92 | + return __rolq(x, shift); |
| 93 | +#else |
56 | 94 | unsigned int n = shift % 64;
|
57 | 95 | return (x << n) | (x >> (64 - n));
|
| 96 | +#endif |
58 | 97 | }
|
59 | 98 |
|
60 | 99 | inline u32 __rotr(u32 x, int shift) {
|
| 100 | +#if defined(_MSC_VER) |
| 101 | + return _rotr(x, shift); |
| 102 | +#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) |
| 103 | + return __rord(x, shift); |
| 104 | +#else |
61 | 105 | shift &= 31;
|
62 | 106 | if (!shift) return x;
|
63 | 107 | return (x >> shift) | (x << (32 - shift));
|
| 108 | +#endif |
64 | 109 | }
|
65 | 110 |
|
66 | 111 | inline u64 __rotr64(u64 x, unsigned int shift){
|
| 112 | +#if defined(_MSC_VER) |
| 113 | + return _rotr64(x, shift); |
| 114 | +#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)) |
| 115 | + return __rorq(x, shift); |
| 116 | +#else |
67 | 117 | unsigned int n = shift % 64;
|
68 | 118 | return (x >> n) | (x << (64 - n));
|
69 |
| -} |
70 |
| - |
71 |
| -#else // WIN32 |
72 |
| - |
73 |
| -// Function Cross-Compatibility |
74 |
| -#ifndef __MINGW32__ |
75 |
| - #define strcasecmp _stricmp |
76 |
| - #define strncasecmp _strnicmp |
77 |
| -#endif |
78 |
| - |
79 |
| -#ifndef __MINGW32__ |
80 |
| -#define unlink _unlink |
81 |
| -#define __rotl _rotl |
82 |
| -#define __rotl64 _rotl64 |
83 |
| -#define __rotr _rotr |
84 |
| -#define __rotr64 _rotr64 |
85 | 119 | #endif
|
86 |
| - |
87 |
| -// 64 bit offsets for windows |
88 |
| -#ifndef __MINGW32__ |
89 |
| - #define fseeko _fseeki64 |
90 |
| - #define ftello _ftelli64 |
91 |
| - #define atoll _atoi64 |
92 |
| -#endif |
93 |
| - #define Crash() {__debugbreak();} |
94 |
| -#endif // WIN32 ndef |
| 120 | +} |
0 commit comments