summaryrefslogtreecommitdiff
path: root/src/common/common_funcs.h
diff options
context:
space:
mode:
authorGravatar archshift2015-02-18 22:46:21 -0800
committerGravatar archshift2015-02-19 22:26:25 -0800
commit4fb75d220aeaa66d3e907cc2311acf6c29433800 (patch)
tree8fa12b7d7dd3fde83ce126c0ffe3c8011d839f4f /src/common/common_funcs.h
parentRemove duplication of INSERT_PADDING_WORDS between pica.h and gpu.h (diff)
downloadyuzu-4fb75d220aeaa66d3e907cc2311acf6c29433800.tar.gz
yuzu-4fb75d220aeaa66d3e907cc2311acf6c29433800.tar.xz
yuzu-4fb75d220aeaa66d3e907cc2311acf6c29433800.zip
Misc cleanup of common and related functions
Diffstat (limited to 'src/common/common_funcs.h')
-rw-r--r--src/common/common_funcs.h23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index daec8f0ff..bc296ed3e 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -24,11 +24,6 @@ template<> struct CompileTimeAssert<true> {};
24#define b32(x) (b16(x) | (b16(x) >>16) ) 24#define b32(x) (b16(x) | (b16(x) >>16) )
25#define ROUND_UP_POW2(x) (b32(x - 1) + 1) 25#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
26 26
27#define MIN(a, b) ((a)<(b)?(a):(b))
28#define MAX(a, b) ((a)>(b)?(a):(b))
29
30#define CLAMP(x, min, max) (((x) > max) ? max : (((x) < min) ? min : (x)))
31
32#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) 27#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
33 28
34/// Textually concatenates two tokens. The double-expansion is required by the C preprocessor. 29/// Textually concatenates two tokens. The double-expansion is required by the C preprocessor.
@@ -147,15 +142,6 @@ inline u64 _rotr64(u64 x, unsigned int shift){
147 #define Crash() {DebugBreak();} 142 #define Crash() {DebugBreak();}
148#endif // _MSC_VER ndef 143#endif // _MSC_VER ndef
149 144
150// Dolphin's min and max functions
151#undef min
152#undef max
153
154template<class T>
155inline T min(const T& a, const T& b) {return a > b ? b : a;}
156template<class T>
157inline T max(const T& a, const T& b) {return a > b ? a : b;}
158
159// Generic function to get last error message. 145// Generic function to get last error message.
160// Call directly after the command or use the error num. 146// Call directly after the command or use the error num.
161// This function might change the error code. 147// This function might change the error code.
@@ -232,13 +218,4 @@ inline void swap<8>(u8* data)
232 *reinterpret_cast<u64*>(data) = swap64(data); 218 *reinterpret_cast<u64*>(data) = swap64(data);
233} 219}
234 220
235template <typename T>
236inline T FromBigEndian(T data)
237{
238 //static_assert(std::is_arithmetic<T>::value, "function only makes sense with arithmetic types");
239
240 swap<sizeof(data)>(reinterpret_cast<u8*>(&data));
241 return data;
242}
243
244} // Namespace Common 221} // Namespace Common