Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 51 additions & 25 deletions Common/CommonFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,49 +46,75 @@
#define Crash() {kill(getpid(), SIGINT);}
#endif

#else // WIN32

// Function Cross-Compatibility
#ifndef __MINGW32__
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif

#ifndef __MINGW32__
#define unlink _unlink
#endif

// 64 bit offsets for windows
#ifndef __MINGW32__
#define fseeko _fseeki64
#define ftello _ftelli64
#define atoll _atoi64
#endif
#define Crash() {__debugbreak();}
#endif // WIN32 ndef

#if defined(_MSC_VER)
#include <cstdlib>
#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64))
#include <x86intrin.h>
#endif

inline u32 __rotl(u32 x, int shift) {
#if defined(_MSC_VER)
return _rotl(x, shift);
#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64))
return __rold(x, shift);
#else
shift &= 31;
if (!shift) return x;
return (x << shift) | (x >> (32 - shift));
#endif
}

inline u64 __rotl64(u64 x, unsigned int shift){
#if defined(_MSC_VER)
return _rotl64(x, shift);
#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64))
return __rolq(x, shift);
#else
unsigned int n = shift % 64;
return (x << n) | (x >> (64 - n));
#endif
}

inline u32 __rotr(u32 x, int shift) {
#if defined(_MSC_VER)
return _rotr(x, shift);
#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64))
return __rord(x, shift);
#else
shift &= 31;
if (!shift) return x;
return (x >> shift) | (x << (32 - shift));
#endif
}

inline u64 __rotr64(u64 x, unsigned int shift){
#if defined(_MSC_VER)
return _rotr64(x, shift);
#elif (PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64))
return __rorq(x, shift);
#else
unsigned int n = shift % 64;
return (x >> n) | (x << (64 - n));
}

#else // WIN32

// Function Cross-Compatibility
#ifndef __MINGW32__
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif

#ifndef __MINGW32__
#define unlink _unlink
#define __rotl _rotl
#define __rotl64 _rotl64
#define __rotr _rotr
#define __rotr64 _rotr64
#endif

// 64 bit offsets for windows
#ifndef __MINGW32__
#define fseeko _fseeki64
#define ftello _ftelli64
#define atoll _atoi64
#endif
#define Crash() {__debugbreak();}
#endif // WIN32 ndef
}
8 changes: 0 additions & 8 deletions Core/MIPS/MIPSInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,7 @@ namespace MIPSInt
}
else if (_RS == 1) //rotr
{
#ifdef __MINGW32__
R(rd) = _rotr(R(rt), sa);
#else
R(rd) = __rotr(R(rt), sa);
#endif
break;
}
else
Expand All @@ -735,11 +731,7 @@ namespace MIPSInt
}
else if (_FD == 1) // rotrv
{
#ifdef __MINGW32__
R(rd) = _rotr(R(rt), R(rs));
#else
R(rd) = __rotr(R(rt), R(rs));
#endif
break;
}
else goto wrong;
Expand Down
6 changes: 3 additions & 3 deletions UI/SavedataScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ bool SavedataBrowser::ByFilename(const UI::View *v1, const UI::View *v2) {
const SavedataButton *b1 = static_cast<const SavedataButton *>(v1);
const SavedataButton *b2 = static_cast<const SavedataButton *>(v2);

return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
return b1->GamePath() < b2->GamePath();
}

void SavedataBrowser::PrepSize(UI::View *v) {
Expand All @@ -517,7 +517,7 @@ bool SavedataBrowser::BySize(const UI::View *v1, const UI::View *v2) {
return true;
else if (size1 < size2)
return false;
return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
return b1->GamePath() < b2->GamePath();
}

void SavedataBrowser::PrepDate(UI::View *v) {
Expand All @@ -535,7 +535,7 @@ bool SavedataBrowser::ByDate(const UI::View *v1, const UI::View *v2) {
return true;
if (time1 < time2)
return false;
return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
return b1->GamePath() < b2->GamePath();
}

void SavedataBrowser::Refresh() {
Expand Down
2 changes: 1 addition & 1 deletion UWP/UWPHelpers/StorageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ bool IsRootForAccessibleItems(Path path, std::list<std::string>& subRoot, bool b
if (!endsWith(sub, ":")) {
bool alreadyAdded = false;
for each (auto sItem in subRoot) {
if (!strcmp(sItem.c_str(), sub.c_str())) {
if (sItem == sub) {
alreadyAdded = true;
break;
}
Expand Down
Loading