From fcf83dbf9effab3bd98bad2b83b2468b7eb05cfd Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 9 Jun 2017 11:34:21 -0700 Subject: Initial import of code. --- source/core/common.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 source/core/common.h (limited to 'source/core/common.h') diff --git a/source/core/common.h b/source/core/common.h new file mode 100644 index 000000000..517b018a7 --- /dev/null +++ b/source/core/common.h @@ -0,0 +1,48 @@ +#ifndef CORE_LIB_COMMON_H +#define CORE_LIB_COMMON_H + +#include + +#ifdef __GNUC__ +#define CORE_LIB_ALIGN_16(x) x __attribute__((aligned(16))) +#else +#define CORE_LIB_ALIGN_16(x) __declspec(align(16)) x +#endif + +#define VARIADIC_TEMPLATE + +namespace CoreLib +{ + typedef int64_t Int64; + typedef unsigned short Word; +#ifdef _M_X64 + typedef int64_t PtrInt; +#else + typedef int PtrInt; +#endif + namespace Basic + { + class Object + { + public: + virtual ~Object() + {} + }; + + template + inline T&& _Move(T & obj) + { + return static_cast(obj); + } + + template + inline void Swap(T & v0, T & v1) + { + T tmp = _Move(v0); + v0 = _Move(v1); + v1 = _Move(tmp); + } + } +} + +#endif -- cgit v1.2.3