diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2019-10-13 00:35:01 +0200 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2019-10-26 13:05:00 +0200 |
commit | d822417cfce5ce0120481bd37271ebde6117b14c (patch) | |
tree | 6cb4988959c8076d29f5b2ff6b5182a02f03e2be /src/core/common.h | |
parent | Fix rebasing (diff) | |
download | re3-d822417cfce5ce0120481bd37271ebde6117b14c.tar re3-d822417cfce5ce0120481bd37271ebde6117b14c.tar.gz re3-d822417cfce5ce0120481bd37271ebde6117b14c.tar.bz2 re3-d822417cfce5ce0120481bd37271ebde6117b14c.tar.lz re3-d822417cfce5ce0120481bd37271ebde6117b14c.tar.xz re3-d822417cfce5ce0120481bd37271ebde6117b14c.tar.zst re3-d822417cfce5ce0120481bd37271ebde6117b14c.zip |
Diffstat (limited to 'src/core/common.h')
-rw-r--r-- | src/core/common.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/core/common.h b/src/core/common.h index d3d4e049..a538ddb6 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -197,8 +197,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define BIT(num) (1<<(num)) -//auto max = [](auto a, auto b) { return ((a) > (b)) ? (a) : (b); }; -//auto min = [](auto a, auto b) { return ((a) < (b)) ? (a) : (b); }; #define ABS(a) (((a) < 0) ? (-(a)) : (a)) #define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min))))) @@ -337,7 +335,7 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip) template<typename T> inline const T ReadSaveBuf(uint8 *&buf) -{
+{ T &value = *(T*)buf; SkipSaveBuf(buf, sizeof(T)); return value; @@ -345,8 +343,8 @@ inline const T ReadSaveBuf(uint8 *&buf) template<typename T> inline T *WriteSaveBuf(uint8 *&buf, const T &value) -{
- T *p = (T*)buf;
+{ + T *p = (T*)buf; *p = value; SkipSaveBuf(buf, sizeof(T)); return p; @@ -355,11 +353,11 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value) #define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32)) -#define WriteSaveHeader(buf,a,b,c,d,size) \
- WriteSaveBuf(buf, a);\
- WriteSaveBuf(buf, b);\
- WriteSaveBuf(buf, c);\
- WriteSaveBuf(buf, d);\
+#define WriteSaveHeader(buf,a,b,c,d,size) \ + WriteSaveBuf(buf, a);\ + WriteSaveBuf(buf, b);\ + WriteSaveBuf(buf, c);\ + WriteSaveBuf(buf, d);\ WriteSaveBuf(buf, size); #define CheckSaveHeader(buf,a,b,c,d,size)\ |