Skip to content

Commit 552c1cc

Browse files
authored
Merge pull request #20483 from oltolm/inline
Some cleanups
2 parents e846aa8 + 1061304 commit 552c1cc

File tree

4 files changed

+55
-37
lines changed

4 files changed

+55
-37
lines changed

Common/CommonFuncs.h

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,75 @@
4646
#define Crash() {kill(getpid(), SIGINT);}
4747
#endif
4848

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+
4976
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
5082
shift &= 31;
5183
if (!shift) return x;
5284
return (x << shift) | (x >> (32 - shift));
85+
#endif
5386
}
5487

5588
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
5694
unsigned int n = shift % 64;
5795
return (x << n) | (x >> (64 - n));
96+
#endif
5897
}
5998

6099
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
61105
shift &= 31;
62106
if (!shift) return x;
63107
return (x >> shift) | (x << (32 - shift));
108+
#endif
64109
}
65110

66111
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
67117
unsigned int n = shift % 64;
68118
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
85119
#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+
}

Core/MIPS/MIPSInt.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -715,11 +715,7 @@ namespace MIPSInt
715715
}
716716
else if (_RS == 1) //rotr
717717
{
718-
#ifdef __MINGW32__
719-
R(rd) = _rotr(R(rt), sa);
720-
#else
721718
R(rd) = __rotr(R(rt), sa);
722-
#endif
723719
break;
724720
}
725721
else
@@ -735,11 +731,7 @@ namespace MIPSInt
735731
}
736732
else if (_FD == 1) // rotrv
737733
{
738-
#ifdef __MINGW32__
739-
R(rd) = _rotr(R(rt), R(rs));
740-
#else
741734
R(rd) = __rotr(R(rt), R(rs));
742-
#endif
743735
break;
744736
}
745737
else goto wrong;

UI/SavedataScreen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ bool SavedataBrowser::ByFilename(const UI::View *v1, const UI::View *v2) {
499499
const SavedataButton *b1 = static_cast<const SavedataButton *>(v1);
500500
const SavedataButton *b2 = static_cast<const SavedataButton *>(v2);
501501

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

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

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

541541
void SavedataBrowser::Refresh() {

UWP/UWPHelpers/StorageManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ bool IsRootForAccessibleItems(Path path, std::list<std::string>& subRoot, bool b
259259
if (!endsWith(sub, ":")) {
260260
bool alreadyAdded = false;
261261
for each (auto sItem in subRoot) {
262-
if (!strcmp(sItem.c_str(), sub.c_str())) {
262+
if (sItem == sub) {
263263
alreadyAdded = true;
264264
break;
265265
}

0 commit comments

Comments
 (0)