Compare commits
3 Commits
2d4dedd876
...
1c01ce5bb6
Author | SHA1 | Date | |
---|---|---|---|
1c01ce5bb6 | |||
a952c31546 | |||
7107fc6b8a |
@ -39,9 +39,24 @@ else ()
|
|||||||
add_compile_definitions ("BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
add_compile_definitions ("BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
# Define compiler macros
|
||||||
|
if (CMAKE_C_COMPILER_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_MSVC=1")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_NAME=MSVC")
|
||||||
|
elseif (CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_GCC=1")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_NAME=GCC")
|
||||||
|
elseif (CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_CLANG=1")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_NAME=Clang")
|
||||||
|
else ()
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_UNKNOWN=1")
|
||||||
|
add_compile_definitions ("PLATFORM_COMPILER_NAME=${CMAKE_C_COMPILER_ID}/${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Add subproject
|
# Add subproject
|
||||||
file (GLOB PROJECT_FOLDERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*")
|
file (GLOB PROJECT_FOLDERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*")
|
||||||
foreach (PROJECT_SUBDIRECTORY ${PROJECT_FOLDERS})
|
foreach (PROJECT_SUBDIRECTORY ${PROJECT_FOLDERS})
|
||||||
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SUBDIRECTORY}")
|
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SUBDIRECTORY}")
|
||||||
file (GLOB PROJECT_CMAKELISTS "${PROJECT_SUBDIRECTORY}/CMakeLists.txt")
|
file (GLOB PROJECT_CMAKELISTS "${PROJECT_SUBDIRECTORY}/CMakeLists.txt")
|
||||||
if (NOT "${PROJECT_CMAKELISTS}" STREQUAL "")
|
if (NOT "${PROJECT_CMAKELISTS}" STREQUAL "")
|
||||||
|
@ -14,7 +14,7 @@ NAMESPACE_REDCRAFT_BEGIN
|
|||||||
NAMESPACE_MODULE_BEGIN(Redcraft)
|
NAMESPACE_MODULE_BEGIN(Redcraft)
|
||||||
NAMESPACE_MODULE_BEGIN(Utility)
|
NAMESPACE_MODULE_BEGIN(Utility)
|
||||||
|
|
||||||
// Build information macro
|
// Platform information macro
|
||||||
|
|
||||||
#ifndef PLATFORM_NAME
|
#ifndef PLATFORM_NAME
|
||||||
# error "PLATFORM_NAME must be defined."
|
# error "PLATFORM_NAME must be defined."
|
||||||
@ -32,6 +32,8 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# define PLATFORM_UNKNOWN 0
|
# define PLATFORM_UNKNOWN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Build information macro
|
||||||
|
|
||||||
#ifndef BUILD_TYPE
|
#ifndef BUILD_TYPE
|
||||||
# error "BUILD_TYPE must be defined."
|
# error "BUILD_TYPE must be defined."
|
||||||
#endif
|
#endif
|
||||||
@ -52,7 +54,29 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# define BUILD_UNKNOWN 0
|
# define BUILD_UNKNOWN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Whether the CPU is x86/x64 (i.e. both 32 and 64-bit variants)
|
// Compiler information macro
|
||||||
|
|
||||||
|
#ifndef PLATFORM_COMPILER_NAME
|
||||||
|
# error "COMPILER_NAME must be defined."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_COMPILER_MSVC
|
||||||
|
# define PLATFORM_COMPILER_MSVC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_COMPILER_CLANG
|
||||||
|
# define PLATFORM_COMPILER_CLANG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_COMPILER_GCC
|
||||||
|
# define PLATFORM_COMPILER_GCC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_COMPILER_UNKNOWN
|
||||||
|
# define PLATFORM_COMPILER_UNKNOWN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Architecture information macro
|
||||||
|
|
||||||
#ifndef PLATFORM_CPU_X86_FAMILY
|
#ifndef PLATFORM_CPU_X86_FAMILY
|
||||||
# if (defined(_M_IX86) || defined(__i386__) || defined(_M_X64) || defined(__amd64__) || defined(__x86_64__))
|
# if (defined(_M_IX86) || defined(__i386__) || defined(_M_X64) || defined(__amd64__) || defined(__x86_64__))
|
||||||
@ -62,8 +86,6 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Whether the CPU is AArch32/AArch64 (i.e. both 32 and 64-bit variants)
|
|
||||||
|
|
||||||
#ifndef PLATFORM_CPU_ARM_FAMILY
|
#ifndef PLATFORM_CPU_ARM_FAMILY
|
||||||
# if (defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || defined(_M_ARM64))
|
# if (defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || defined(_M_ARM64))
|
||||||
# define PLATFORM_CPU_ARM_FAMILY 1
|
# define PLATFORM_CPU_ARM_FAMILY 1
|
||||||
@ -72,9 +94,171 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_CPU_UNKNOWN_FAMILY
|
||||||
|
# define PLATFORM_CPU_UNKNOWN_FAMILY (!(PLATFORM_CPU_X86_FAMILY || PLATFORM_CPU_ARM_FAMILY))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// CPU bits information macro
|
||||||
|
|
||||||
|
#ifndef PLATFORM_CPU_BITS
|
||||||
|
# if (defined(_M_X64) || defined(__amd64__) || defined(__x86_64__) || defined(__aarch64__) || defined(_M_ARM64))
|
||||||
|
# define PLATFORM_CPU_BITS 64
|
||||||
|
# elif (defined(_M_IX86) || defined(__i386__) || defined(__arm__) || defined(_M_ARM))
|
||||||
|
# define PLATFORM_CPU_BITS 32
|
||||||
|
# else
|
||||||
|
# define PLATFORM_CPU_BITS 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Endian information macro
|
||||||
|
|
||||||
|
#if !defined(PLATFORM_LITTLE_ENDIAN) && !defined(PLATFORM_BIG_ENDIAN)
|
||||||
|
# if PLATFORM_COMPILER_MSVC
|
||||||
|
# define PLATFORM_LITTLE_ENDIAN 1
|
||||||
|
# define PLATFORM_BIG_ENDIAN 0
|
||||||
|
# elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
|
||||||
|
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
|
# define PLATFORM_LITTLE_ENDIAN 1
|
||||||
|
# define PLATFORM_BIG_ENDIAN 0
|
||||||
|
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
# define PLATFORM_LITTLE_ENDIAN 0
|
||||||
|
# define PLATFORM_BIG_ENDIAN 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_LITTLE_ENDIAN 0
|
||||||
|
# define PLATFORM_BIG_ENDIAN 0
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_LITTLE_ENDIAN
|
||||||
|
# define PLATFORM_LITTLE_ENDIAN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_BIG_ENDIAN
|
||||||
|
# define PLATFORM_BIG_ENDIAN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_CPU_MIXED_ENDIAN
|
||||||
|
# define PLATFORM_MIXED_ENDIAN (!(PLATFORM_LITTLE_ENDIAN || PLATFORM_BIG_ENDIAN))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Integral type information macro
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_INT8
|
||||||
|
# define PLATFORM_HAS_INT8 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_INT16
|
||||||
|
# define PLATFORM_HAS_INT16 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_INT32
|
||||||
|
# define PLATFORM_HAS_INT32 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_INT64
|
||||||
|
# define PLATFORM_HAS_INT64 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_INT128
|
||||||
|
# if defined(__SIZEOF_INT128__)
|
||||||
|
# define PLATFORM_HAS_INT128 (__SIZEOF_INT128__ == 16)
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_INT128 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_INTMAX_BITS
|
||||||
|
# if PLATFORM_HAS_INT128
|
||||||
|
# define PLATFORM_INTMAX_BITS 128
|
||||||
|
# else
|
||||||
|
# define PLATFORM_INTMAX_BITS 64
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(PLATFORM_HAS_INT8 && PLATFORM_HAS_INT16 && PLATFORM_HAS_INT32 && PLATFORM_HAS_INT64)
|
||||||
|
# error "64-bit and below integral types must be supported."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Floating point type information macro
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_FLOAT16
|
||||||
|
# if defined(__STDCPP_FLOAT16_T__)
|
||||||
|
# define PLATFORM_HAS_FLOAT16 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_FLOAT16 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_FLOAT32
|
||||||
|
# define PLATFORM_HAS_FLOAT32 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_FLOAT64
|
||||||
|
# define PLATFORM_HAS_FLOAT64 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_FLOAT128
|
||||||
|
# if defined(__STDCPP_FLOAT128_T__)
|
||||||
|
# define PLATFORM_HAS_FLOAT128 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_FLOAT128 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_BFLOAT16
|
||||||
|
# if defined(__STDCPP_BFLOAT16_T__)
|
||||||
|
# define PLATFORM_HAS_BFLOAT16 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_BFLOAT16 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Character type information macro
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_WCHAR
|
||||||
|
# define PLATFORM_HAS_WCHAR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_U8CHAR
|
||||||
|
# ifdef __cpp_char8_t
|
||||||
|
# define PLATFORM_HAS_U8CHAR 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_U8CHAR 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_U16CHAR
|
||||||
|
# ifdef __cpp_unicode_characters
|
||||||
|
# define PLATFORM_HAS_U16CHAR 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_U16CHAR 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_U32CHAR
|
||||||
|
# ifdef __cpp_unicode_characters
|
||||||
|
# define PLATFORM_HAS_U32CHAR 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_U32CHAR 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PLATFORM_HAS_UNICODECHAR
|
||||||
|
# ifdef __cpp_unicode_characters
|
||||||
|
# define PLATFORM_HAS_UNICODECHAR 1
|
||||||
|
# else
|
||||||
|
# define PLATFORM_HAS_UNICODECHAR 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(PLATFORM_HAS_WCHAR && PLATFORM_HAS_U8CHAR && PLATFORM_HAS_U16CHAR && PLATFORM_HAS_U32CHAR)
|
||||||
|
# error "All character types must be supported."
|
||||||
|
#endif
|
||||||
|
|
||||||
// Function type macros
|
// Function type macros
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_COMPILER_MSVC
|
||||||
|
|
||||||
# define VARARGS __cdecl
|
# define VARARGS __cdecl
|
||||||
# define CDECL __cdecl
|
# define CDECL __cdecl
|
||||||
@ -83,7 +267,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# define FORCENOINLINE __declspec(noinline)
|
# define FORCENOINLINE __declspec(noinline)
|
||||||
# define RESTRICT __restrict
|
# define RESTRICT __restrict
|
||||||
|
|
||||||
#elif PLATFORM_LINUX
|
#elif PLATFORM_COMPILER_CLANG || PLATFORM_COMPILER_GCC
|
||||||
|
|
||||||
# define VARARGS
|
# define VARARGS
|
||||||
# define CDECL
|
# define CDECL
|
||||||
@ -110,10 +294,10 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
|
|
||||||
// DLL export and import macros
|
// DLL export and import macros
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_COMPILER_MSVC
|
||||||
# define DLLEXPORT __declspec(dllexport)
|
# define DLLEXPORT __declspec(dllexport)
|
||||||
# define DLLIMPORT __declspec(dllimport)
|
# define DLLIMPORT __declspec(dllimport)
|
||||||
#elif PLATFORM_LINUX
|
#elif PLATFORM_COMPILER_CLANG || PLATFORM_COMPILER_GCC
|
||||||
# define DLLEXPORT __attribute__((visibility("default")))
|
# define DLLEXPORT __attribute__((visibility("default")))
|
||||||
# define DLLIMPORT __attribute__((visibility("default")))
|
# define DLLIMPORT __attribute__((visibility("default")))
|
||||||
#else
|
#else
|
||||||
@ -122,13 +306,13 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
|
|
||||||
// Optimization macros
|
// Optimization macros
|
||||||
|
|
||||||
#if !defined(__clang__)
|
#if PLATFORM_COMPILER_MSVC
|
||||||
# define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("optimize(\"\", off)")
|
# define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("optimize(\"\", off)")
|
||||||
# define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("optimize(\"\", on)")
|
# define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("optimize(\"\", on)")
|
||||||
#elif defined(_MSC_VER)
|
#elif PLATFORM_COMPILER_CLANG
|
||||||
# define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("clang optimize off")
|
# define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("clang optimize off")
|
||||||
# define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("clang optimize on")
|
# define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("clang optimize on")
|
||||||
#elif defined(__GNUC__ )
|
#elif PLATFORM_COMPILER_GCC
|
||||||
# define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("GCC push_options") _Pragma("GCC optimize (\"O0\")")
|
# define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("GCC push_options") _Pragma("GCC optimize (\"O0\")")
|
||||||
# define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("GCC pop_options")
|
# define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("GCC pop_options")
|
||||||
#else
|
#else
|
||||||
@ -144,13 +328,6 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# define PRAGMA_ENABLE_OPTIMIZATION PRAGMA_ENABLE_OPTIMIZATION_ACTUAL
|
# define PRAGMA_ENABLE_OPTIMIZATION PRAGMA_ENABLE_OPTIMIZATION_ACTUAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Unsigned integral types
|
|
||||||
|
|
||||||
using uint8 = NAMESPACE_STD::uint8_t;
|
|
||||||
using uint16 = NAMESPACE_STD::uint16_t;
|
|
||||||
using uint32 = NAMESPACE_STD::uint32_t;
|
|
||||||
using uint64 = NAMESPACE_STD::uint64_t;
|
|
||||||
|
|
||||||
// Signed integral types
|
// Signed integral types
|
||||||
|
|
||||||
using int8 = NAMESPACE_STD::int8_t;
|
using int8 = NAMESPACE_STD::int8_t;
|
||||||
@ -158,35 +335,99 @@ using int16 = NAMESPACE_STD::int16_t;
|
|||||||
using int32 = NAMESPACE_STD::int32_t;
|
using int32 = NAMESPACE_STD::int32_t;
|
||||||
using int64 = NAMESPACE_STD::int64_t;
|
using int64 = NAMESPACE_STD::int64_t;
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using int128 = __int128;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using int8_least = NAMESPACE_STD::int_least8_t;
|
||||||
|
using int16_least = NAMESPACE_STD::int_least16_t;
|
||||||
|
using int32_least = NAMESPACE_STD::int_least32_t;
|
||||||
|
using int64_least = NAMESPACE_STD::int_least64_t;
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using int128_least = int128;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using int8_fast = NAMESPACE_STD::int_fast8_t;
|
||||||
|
using int16_fast = NAMESPACE_STD::int_fast16_t;
|
||||||
|
using int32_fast = NAMESPACE_STD::int_fast32_t;
|
||||||
|
using int64_fast = NAMESPACE_STD::int_fast64_t;
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using int128_fast = int128;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using intmax = int128;
|
||||||
|
#else
|
||||||
|
using intmax = int64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Unsigned integral types
|
||||||
|
|
||||||
|
using uint8 = NAMESPACE_STD::uint8_t;
|
||||||
|
using uint16 = NAMESPACE_STD::uint16_t;
|
||||||
|
using uint32 = NAMESPACE_STD::uint32_t;
|
||||||
|
using uint64 = NAMESPACE_STD::uint64_t;
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using uint128 = unsigned __int128;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using uint8_least = NAMESPACE_STD::uint_least8_t;
|
||||||
|
using uint16_least = NAMESPACE_STD::uint_least16_t;
|
||||||
|
using uint32_least = NAMESPACE_STD::uint_least32_t;
|
||||||
|
using uint64_least = NAMESPACE_STD::uint_least64_t;
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using uint128_least = uint128;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using uint8_fast = NAMESPACE_STD::int_fast8_t;
|
||||||
|
using uint16_fast = NAMESPACE_STD::int_fast16_t;
|
||||||
|
using uint32_fast = NAMESPACE_STD::int_fast32_t;
|
||||||
|
using uint64_fast = NAMESPACE_STD::int_fast64_t;
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using uint128_fast = uint128;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PLATFORM_HAS_INT128
|
||||||
|
using uintmax = uint128;
|
||||||
|
#else
|
||||||
|
using uintmax = uint64;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Floating point types
|
// Floating point types
|
||||||
|
|
||||||
#if defined(__STDCPP_FLOAT16_T__)
|
#if PLATFORM_HAS_FLOAT16
|
||||||
using float16 = NAMESPACE_STD::float16_t;
|
using float16 = NAMESPACE_STD::float16_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__STDCPP_FLOAT32_T__)
|
#if PLATFORM_HAS_FLOAT32
|
||||||
|
# ifdef __STDCPP_FLOAT32_T__
|
||||||
using float32 = NAMESPACE_STD::float32_t;
|
using float32 = NAMESPACE_STD::float32_t;
|
||||||
#else
|
# else
|
||||||
using float32 = float;
|
using float32 = float;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__STDCPP_FLOAT64_T__)
|
#if PLATFORM_HAS_FLOAT64
|
||||||
|
# ifdef __STDCPP_FLOAT64_T__
|
||||||
using float64 = NAMESPACE_STD::float64_t;
|
using float64 = NAMESPACE_STD::float64_t;
|
||||||
#else
|
# else
|
||||||
using float64 = double;
|
using float64 = double;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__STDCPP_FLOAT128_T__)
|
#if PLATFORM_HAS_FLOAT128
|
||||||
using float128 = NAMESPACE_STD::float128_t;
|
using float128 = NAMESPACE_STD::float128_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__STDCPP_BFLOAT16_T__)
|
#if PLATFORM_HAS_BFLOAT16
|
||||||
using bfloat16 = NAMESPACE_STD::bfloat16_t;
|
using bfloat16 = NAMESPACE_STD::bfloat16_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static_assert(sizeof(float32) == 4);
|
|
||||||
static_assert(sizeof(float64) == 8);
|
|
||||||
|
|
||||||
// Character types
|
// Character types
|
||||||
|
|
||||||
// The 'char' typically represents the user-preferred locale narrow encoded character set.
|
// The 'char' typically represents the user-preferred locale narrow encoded character set.
|
||||||
|
Loading…
Reference in New Issue
Block a user