2021-09-26 15:24:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Misc/CoreDefines.h"
|
|
|
|
|
2021-10-05 10:33:18 +00:00
|
|
|
#include <new>
|
2021-09-26 15:24:15 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdlib>
|
2021-10-03 14:40:10 +00:00
|
|
|
#include <cstddef>
|
2021-09-26 15:24:15 +00:00
|
|
|
|
|
|
|
NS_REDCRAFT_BEGIN
|
|
|
|
|
|
|
|
// Function type macros.
|
2021-10-03 14:40:10 +00:00
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
#if PLATFORM_WINDOWS
|
|
|
|
|
|
|
|
#define VARARGS __cdecl
|
|
|
|
#define CDECL __cdecl
|
|
|
|
#define STDCALL __stdcall
|
|
|
|
#define FORCEINLINE __forceinline
|
|
|
|
#define FORCENOINLINE __declspec(noinline)
|
|
|
|
#define RESTRICT __restrict
|
|
|
|
|
|
|
|
#elif PLATFORM_LINUX
|
|
|
|
|
|
|
|
#define VARARGS
|
|
|
|
#define CDECL
|
|
|
|
#define STDCALL
|
|
|
|
#define FORCENOINLINE __attribute__((noinline))
|
|
|
|
#define RESTRICT __restrict
|
|
|
|
|
|
|
|
#if BUILD_DEBUG
|
|
|
|
#define FORCEINLINE inline
|
|
|
|
#else
|
|
|
|
#define FORCEINLINE inline __attribute__ ((always_inline))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define VARARGS
|
|
|
|
#define CDECL
|
|
|
|
#define STDCALL
|
|
|
|
#define FORCEINLINE
|
|
|
|
#define FORCENOINLINE
|
|
|
|
#define RESTRICT __restrict
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Alignment.
|
2021-10-03 14:40:10 +00:00
|
|
|
|
2021-10-05 10:33:18 +00:00
|
|
|
#if PLATFORM_WINDOWS
|
2021-09-26 15:24:15 +00:00
|
|
|
|
2021-10-05 10:33:18 +00:00
|
|
|
#if defined(__clang__)
|
|
|
|
|
|
|
|
#define GCC_PACK(n) __attribute__((packed,aligned(n)))
|
|
|
|
#define GCC_ALIGN(n) __attribute__((aligned(n)))
|
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define MS_ALIGN(n) __declspec(align(n))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define GCC_PACK(n)
|
|
|
|
#define GCC_ALIGN(n)
|
|
|
|
#define MS_ALIGN(n) __declspec(align(n))
|
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
#endif
|
2021-10-05 10:33:18 +00:00
|
|
|
|
|
|
|
#elif PLATFORM_LINUX
|
|
|
|
|
|
|
|
#define GCC_PACK(n) __attribute__((packed,aligned(n)))
|
|
|
|
#define GCC_ALIGN(n) __attribute__((aligned(n)))
|
|
|
|
#define MS_ALIGN(n)
|
2021-09-26 15:24:15 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define GCC_PACK(n)
|
|
|
|
#define GCC_ALIGN(n)
|
2021-10-05 10:33:18 +00:00
|
|
|
#define MS_ALIGN(n)
|
2021-09-26 15:24:15 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-10-03 14:40:10 +00:00
|
|
|
// DLL export and import definitions.
|
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
#if PLATFORM_WINDOWS
|
|
|
|
|
|
|
|
#define DLLEXPORT __declspec(dllexport)
|
|
|
|
#define DLLIMPORT __declspec(dllimport)
|
|
|
|
|
|
|
|
#elif PLATFORM_LINUX
|
|
|
|
|
|
|
|
#define DLLEXPORT __attribute__((visibility("default")))
|
|
|
|
#define DLLIMPORT __attribute__((visibility("default")))
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define DLLEXPORT
|
|
|
|
#define DLLIMPORT
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Unsigned base types.
|
2021-10-03 14:40:10 +00:00
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
typedef std::uint8_t uint8;
|
|
|
|
typedef std::uint16_t uint16;
|
|
|
|
typedef std::uint32_t uint32;
|
|
|
|
typedef std::uint64_t uint64;
|
|
|
|
|
|
|
|
// Signed base types.
|
2021-10-03 14:40:10 +00:00
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
typedef std::int8_t int8;
|
|
|
|
typedef std::int16_t int16;
|
|
|
|
typedef std::int32_t int32;
|
|
|
|
typedef std::int64_t int64;
|
|
|
|
|
|
|
|
// Character types.
|
2021-10-03 14:40:10 +00:00
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
typedef char ANSICHAR;
|
|
|
|
typedef wchar_t WIDECHAR;
|
|
|
|
typedef WIDECHAR TCHAR;
|
|
|
|
|
2021-10-03 14:40:10 +00:00
|
|
|
// Pointer types.
|
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
typedef std::uintptr_t uintptr_t;
|
|
|
|
typedef std::intptr_t intptr_t;
|
|
|
|
typedef std::size_t size_t;
|
|
|
|
typedef intptr_t ssize_t;
|
|
|
|
|
2021-10-03 14:40:10 +00:00
|
|
|
// Null types.
|
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
typedef decltype(NULL) null_t;
|
|
|
|
typedef std::nullptr_t nullptr_t;
|
|
|
|
|
|
|
|
#if PLATFORM_LINUX
|
|
|
|
#define PLATFORM_TCHAR_IS_CHAR16 1
|
|
|
|
#else
|
|
|
|
#define PLATFORM_TCHAR_IS_CHAR16 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Define the TEXT macro.
|
2021-10-03 14:40:10 +00:00
|
|
|
|
2021-09-26 15:24:15 +00:00
|
|
|
#if PLATFORM_TCHAR_IS_CHAR16
|
|
|
|
#define TEXT_PASTE(x) u ## x
|
|
|
|
#else
|
|
|
|
#define TEXT_PASTE(x) L ## x
|
|
|
|
#endif
|
|
|
|
#define TEXT(x) TEXT_PASTE(x)
|
|
|
|
|
|
|
|
NS_REDCRAFT_END
|