summaryrefslogtreecommitdiff
path: root/src/common/common.h
diff options
context:
space:
mode:
authorGravatar archshift2015-03-05 22:46:45 -0800
committerGravatar archshift2015-03-05 22:46:45 -0800
commite011acaa84a6c2a60959a4b1ecd7e73e349605f2 (patch)
treebea33469eebc06d4e72b1961f689cbc8b3df076d /src/common/common.h
parentMerge pull request #615 from Subv/services (diff)
downloadyuzu-e011acaa84a6c2a60959a4b1ecd7e73e349605f2.tar.gz
yuzu-e011acaa84a6c2a60959a4b1ecd7e73e349605f2.tar.xz
yuzu-e011acaa84a6c2a60959a4b1ecd7e73e349605f2.zip
Removed swap code redundancy and moved common swap code to swap.h
Diffstat (limited to 'src/common/common.h')
-rw-r--r--src/common/common.h36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/common/common.h b/src/common/common.h
index 948dc536a..f7d0f55c5 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -117,40 +117,4 @@ enum EMUSTATE_CHANGE
117 EMUSTATE_CHANGE_STOP 117 EMUSTATE_CHANGE_STOP
118}; 118};
119 119
120
121#ifdef _MSC_VER
122inline unsigned long long bswap64(unsigned long long x) { return _byteswap_uint64(x); }
123inline unsigned int bswap32(unsigned int x) { return _byteswap_ulong(x); }
124inline unsigned short bswap16(unsigned short x) { return _byteswap_ushort(x); }
125#else
126// TODO: speedup
127inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); }
128inline unsigned int bswap32(unsigned int x) { return (x >> 24) | ((x & 0xFF0000) >> 8) | ((x & 0xFF00) << 8) | (x << 24);}
129inline unsigned long long bswap64(unsigned long long x) {return ((unsigned long long)bswap32(x) << 32) | bswap32(x >> 32); }
130#endif
131
132inline float bswapf(float f) {
133 union {
134 float f;
135 unsigned int u32;
136 } dat1, dat2;
137
138 dat1.f = f;
139 dat2.u32 = bswap32(dat1.u32);
140
141 return dat2.f;
142}
143
144inline double bswapd(double f) {
145 union {
146 double f;
147 unsigned long long u64;
148 } dat1, dat2;
149
150 dat1.f = f;
151 dat2.u64 = bswap64(dat1.u64);
152
153 return dat2.f;
154}
155
156#include "swap.h" 120#include "swap.h"