This commit is contained in:
Isuru Samarathunga
2025-11-03 01:46:13 +05:30
parent 2498e7d6e3
commit cdc44137e8

View File

@ -19,13 +19,14 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <new>
#include <cstddef>
#include <concepts>
#include <functional>
#include <assert.h> #include <assert.h>
#include <type_traits> #include <concepts>
#include <cstddef>
#include <functional>
#include <initializer_list> #include <initializer_list>
#include <new>
#include <sstream>
#include <type_traits>
#define IAC_SEC_LEVEL(v) (IACORE_SECURITY_LEVEL >= v) #define IAC_SEC_LEVEL(v) (IACORE_SECURITY_LEVEL >= v)
@ -66,12 +67,12 @@
#define INLINE inline #define INLINE inline
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
#define ALWAYS_INLINE __attribute__((always_inline)) inline #define ALWAYS_INLINE __attribute__((always_inline)) inline
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define ALWAYS_INLINE __forceinline #define ALWAYS_INLINE __forceinline
#endif #endif
#define UNUSED(v) ((void)v); #define UNUSED(v) ((void) v);
#define NO_DISCARD(s) [[nodiscard(s)]] #define NO_DISCARD(s) [[nodiscard(s)]]
@ -110,16 +111,17 @@
#define C_DECL(f) EXTERN "C" f #define C_DECL(f) EXTERN "C" f
#define CAST(v, t) ((t)v) #define CAST(v, t) ((t) v)
#define ALIAS_FUNCTION(alias, function) template <typename... Args> \ #define ALIAS_FUNCTION(alias, function) \
auto alias(Args&&... args) -> decltype(f(std::forward<Args>(args)...)) \ template<typename... Args> auto alias(Args &&...args) -> decltype(f(std::forward<Args>(args)...)) \
{ \ { \
return function(std::forward<Args>(args)...); \ return function(std::forward<Args>(args)...); \
} }
#define ALIAS_TEMPLATE_FUNCTION(t, alias, function) template <typename t, typename... Args> \ #define ALIAS_TEMPLATE_FUNCTION(t, alias, function) \
auto alias(Args&&... args) -> decltype(function<t>(std::forward<Args>(args)...)) \ template<typename t, typename... Args> \
auto alias(Args &&...args) -> decltype(function<t>(std::forward<Args>(args)...)) \
{ \ { \
return function<t>(std::forward<Args>(args)...); \ return function<t>(std::forward<Args>(args)...); \
} }
@ -150,18 +152,29 @@
#define IA_MAX_STRING_LENGTH (IA_MAX_POSSIBLE_SIZE >> 8) #define IA_MAX_STRING_LENGTH (IA_MAX_POSSIBLE_SIZE >> 8)
#define IA_VERSION_TYPE UINT64 #define IA_VERSION_TYPE UINT64
#define IA_MAKE_VERSION(major, minor, patch) ((static_cast<UINT64>(major) & 0xFFFFFF) << 40) | ((static_cast<UINT64>(minor) & 0xFFFFFF) << 16) | (static_cast<UINT64>(patch) & 0xFFFF) #define IA_MAKE_VERSION(major, minor, patch) \
#define IA_STRINGIFY_VERSION(version) BuildString("v", (version >> 40) & 0xFFFFFF, ".", (version >> 16) & 0xFFFFFF, ".", version & 0xFFFF) ((static_cast<UINT64>(major) & 0xFFFFFF) << 40) | ((static_cast<UINT64>(minor) & 0xFFFFFF) << 16) | \
(static_cast<UINT64>(patch) & 0xFFFF)
#define IA_STRINGIFY_VERSION(version) \
BuildString("v", (version >> 40) & 0xFFFFFF, ".", (version >> 16) & 0xFFFFFF, ".", version & 0xFFFF)
#define IA_PARSE_VERSION_STRING(versionString) \
[](IN std::string str) { \
INT32 minor, major, patch; \
char dot; \
std::stringstream ss(str); \
ss >> major >> dot >> minor >> dot >> patch; \
return IA_MAKE_VERSION(major, minor, patch); \
}(versionString)
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define IA_DLL_EXPORT __declspec(dllexport) #define IA_DLL_EXPORT __declspec(dllexport)
#define IA_DLL_IMPORT __declspec(dllimport) #define IA_DLL_IMPORT __declspec(dllimport)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define IA_DLL_EXPORT __attribute__((visibility("default"))) #define IA_DLL_EXPORT __attribute__((visibility("default")))
#define IA_DLL_IMPORT #define IA_DLL_IMPORT
#else #else
#define IA_DLL_EXPORT #define IA_DLL_EXPORT
#define IA_DLL_IMPORT #define IA_DLL_IMPORT
#endif #endif
#define __CC_BLACK "\033[30m" #define __CC_BLACK "\033[30m"