summaryrefslogtreecommitdiff
path: root/src/common/common_funcs.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-05-06 23:13:27 -0300
committerGravatar Yuri Kunde Schlesner2015-05-07 15:45:20 -0300
commita594fdb66e70f6dd45ed8ed1a0969262b0529395 (patch)
tree2006c73f5c59596fb83da9666a698355c5d75d84 /src/common/common_funcs.h
parentCommon: Move IO-specific compatibility macros to file_util.cpp (diff)
downloadyuzu-a594fdb66e70f6dd45ed8ed1a0969262b0529395.tar.gz
yuzu-a594fdb66e70f6dd45ed8ed1a0969262b0529395.tar.xz
yuzu-a594fdb66e70f6dd45ed8ed1a0969262b0529395.zip
Common: Remove more unused compatibility defines
Diffstat (limited to 'src/common/common_funcs.h')
-rw-r--r--src/common/common_funcs.h45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 56ae791d4..973d83544 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -7,13 +7,6 @@
7#include "common_types.h" 7#include "common_types.h"
8#include <cstdlib> 8#include <cstdlib>
9 9
10#ifdef _WIN32
11#define SLEEP(x) Sleep(x)
12#else
13#include <unistd.h>
14#define SLEEP(x) usleep(x*1000)
15#endif
16
17 10
18#define b2(x) ( (x) | ( (x) >> 1) ) 11#define b2(x) ( (x) | ( (x) >> 1) )
19#define b4(x) ( b2(x) | ( b2(x) >> 2) ) 12#define b4(x) ( b2(x) | ( b2(x) >> 2) )
@@ -73,49 +66,11 @@ inline u64 _rotr64(u64 x, unsigned int shift){
73} 66}
74 67
75#else // _MSC_VER 68#else // _MSC_VER
76 #include <locale.h>
77
78 // Function Cross-Compatibility 69 // Function Cross-Compatibility
79 #define snprintf _snprintf 70 #define snprintf _snprintf
80 71
81 // Locale Cross-Compatibility 72 // Locale Cross-Compatibility
82 #define locale_t _locale_t 73 #define locale_t _locale_t
83 #define freelocale _free_locale
84 #define newlocale(mask, locale, base) _create_locale(mask, locale)
85
86 #define LC_GLOBAL_LOCALE ((locale_t)-1)
87 #define LC_ALL_MASK LC_ALL
88 #define LC_COLLATE_MASK LC_COLLATE
89 #define LC_CTYPE_MASK LC_CTYPE
90 #define LC_MONETARY_MASK LC_MONETARY
91 #define LC_NUMERIC_MASK LC_NUMERIC
92 #define LC_TIME_MASK LC_TIME
93
94 inline locale_t uselocale(locale_t new_locale)
95 {
96 // Retrieve the current per thread locale setting
97 bool bIsPerThread = (_configthreadlocale(0) == _ENABLE_PER_THREAD_LOCALE);
98
99 // Retrieve the current thread-specific locale
100 locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE;
101
102 if(new_locale == LC_GLOBAL_LOCALE)
103 {
104 // Restore the global locale
105 _configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
106 }
107 else if(new_locale != nullptr)
108 {
109 // Configure the thread to set the locale only for this thread
110 _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
111
112 // Set all locale categories
113 for(int i = LC_MIN; i <= LC_MAX; i++)
114 setlocale(i, new_locale->locinfo->lc_category[i].locale);
115 }
116
117 return old_locale;
118 }
119 74
120 extern "C" { 75 extern "C" {
121 __declspec(dllimport) void __stdcall DebugBreak(void); 76 __declspec(dllimport) void __stdcall DebugBreak(void);