summaryrefslogtreecommitdiffstats
path: root/src/common/common_funcs.h
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2014-11-19 09:49:13 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2014-11-19 10:03:07 +0100
commitf5d38649c7ad6fedf9db95044e3ad91ce393b8df (patch)
tree57cd232d34d8f889315331a84f0812e705d2ea88 /src/common/common_funcs.h
parentMerge pull request #212 from archshift/idea (diff)
downloadyuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.gz
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.bz2
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.lz
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.xz
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.zst
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.zip
Diffstat (limited to 'src/common/common_funcs.h')
-rw-r--r--src/common/common_funcs.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index c18afe119..d84ec4c42 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -17,7 +17,7 @@ template<> struct CompileTimeAssert<true> {};
#define b2(x) ( (x) | ( (x) >> 1) )
#define b4(x) ( b2(x) | ( b2(x) >> 2) )
#define b8(x) ( b4(x) | ( b4(x) >> 4) )
-#define b16(x) ( b8(x) | ( b8(x) >> 8) )
+#define b16(x) ( b8(x) | ( b8(x) >> 8) )
#define b32(x) (b16(x) | (b16(x) >>16) )
#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
@@ -79,12 +79,12 @@ inline u64 _rotr64(u64 x, unsigned int shift){
#define unlink _unlink
#define snprintf _snprintf
#define vscprintf _vscprintf
-
+
// Locale Cross-Compatibility
#define locale_t _locale_t
#define freelocale _free_locale
#define newlocale(mask, locale, base) _create_locale(mask, locale)
-
+
#define LC_GLOBAL_LOCALE ((locale_t)-1)
#define LC_ALL_MASK LC_ALL
#define LC_COLLATE_MASK LC_COLLATE
@@ -92,7 +92,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
#define LC_MONETARY_MASK LC_MONETARY
#define LC_NUMERIC_MASK LC_NUMERIC
#define LC_TIME_MASK LC_TIME
-
+
inline locale_t uselocale(locale_t new_locale)
{
// Retrieve the current per thread locale setting
@@ -168,8 +168,8 @@ inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
#elif _M_ARM
-inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;}
-inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;}
+inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;}
+inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;}
inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);}
#elif __linux__
inline u16 swap16(u16 _data) {return bswap_16(_data);}
@@ -226,7 +226,7 @@ template <typename T>
inline T FromBigEndian(T data)
{
//static_assert(std::is_arithmetic<T>::value, "function only makes sense with arithmetic types");
-
+
swap<sizeof(data)>(reinterpret_cast<u8*>(&data));
return data;
}