diff --git a/Redcraft.Utility/Source/Public/Miscellaneous/Platform.h b/Redcraft.Utility/Source/Public/Miscellaneous/Platform.h index 096dee5..c6c303c 100644 --- a/Redcraft.Utility/Source/Public/Miscellaneous/Platform.h +++ b/Redcraft.Utility/Source/Public/Miscellaneous/Platform.h @@ -378,13 +378,16 @@ static_assert(sizeof(int16_fast) >= 2, "int16_fast must be at least 2 bytes"); static_assert(sizeof(int32_fast) >= 4, "int32_fast must be at least 4 bytes"); static_assert(sizeof(int64_fast) >= 8, "int64_fast must be at least 8 bytes"); -static_assert(int8(0xFF) == -1, "int8 use two's complement"); -static_assert(int16(0xFFFF) == -1, "int16 use two's complement"); -static_assert(int32(0xFFFFFFFF) == -1, "int32 use two's complement"); -static_assert(int64(0xFFFFFFFFFFFFFFFF) == -1, "int64 use two's complement"); +static_assert(static_cast(0xFF) == -1, "int8 use two's complement"); +static_assert(static_cast(0xFFFF) == -1, "int16 use two's complement"); +static_assert(static_cast(0xFFFFFFFF) == -1, "int32 use two's complement"); +static_assert(static_cast(0xFFFFFFFFFFFFFFFF) == -1, "int64 use two's complement"); // Unsigned integral types +using uint = unsigned int; +using byte = unsigned char; + using uint8 = NAMESPACE_STD::uint8_t; using uint16 = NAMESPACE_STD::uint16_t; using uint32 = NAMESPACE_STD::uint32_t; @@ -491,16 +494,13 @@ static_assert(!PLATFORM_LINUX || sizeof(wchar) == sizeof(u32char), "wchar repr // Pointer types using uintptr = NAMESPACE_STD::uintptr_t; -using intptr = NAMESPACE_STD::intptr_t; using ptrdiff = NAMESPACE_STD::ptrdiff_t; using size_t = NAMESPACE_STD::size_t; -using ssize_t = intptr_t; static_assert(sizeof(uintptr) == sizeof(void*), "uintptr must be the same size as a pointer"); -static_assert(sizeof( intptr) == sizeof(void*), "intptr must be the same size as a pointer"); - +static_assert(sizeof(ptrdiff) == sizeof(void*), "ptrdiff must be the same size as a pointer"); +static_assert(sizeof(size_t) == sizeof(void*), "size_t must be the same size as a pointer"); static_assert(static_cast(-1) > static_cast(0), "uintptr must be unsigned"); -static_assert(static_cast< intptr>(-1) < static_cast< intptr>(0), "intptr must be signed"); // Null types diff --git a/Redcraft.Utility/Source/Public/Templates/Function.h b/Redcraft.Utility/Source/Public/Templates/Function.h index 4a7440c..68ea927 100644 --- a/Redcraft.Utility/Source/Public/Templates/Function.h +++ b/Redcraft.Utility/Source/Public/Templates/Function.h @@ -75,7 +75,7 @@ public: // Make sure you call this function after you have destroyed the held object using Destroy(). template - FORCEINLINE constexpr void Emplace(intptr InCallable, U&& Args) + FORCEINLINE constexpr void Emplace(uintptr InCallable, U&& Args) { static_assert(CSameAs, TDecay>); ValuePtr = reinterpret_cast(AddressOf(Args)); diff --git a/Redcraft.Utility/Source/Public/Templates/TypeHash.h b/Redcraft.Utility/Source/Public/Templates/TypeHash.h index f6ef5d9..0e72e32 100644 --- a/Redcraft.Utility/Source/Public/Templates/TypeHash.h +++ b/Redcraft.Utility/Source/Public/Templates/TypeHash.h @@ -53,7 +53,7 @@ FORCEINLINE constexpr size_t GetTypeHash(T A) if constexpr (sizeof(T) == 8) return GetTypeHash(static_cast(A)) ^ GetTypeHash(static_cast(A >> 32)); if constexpr (sizeof(T) == 16) return GetTypeHash(static_cast(A)) ^ GetTypeHash(static_cast(A >> 64)); else check_no_entry(); - + return INDEX_NONE; } @@ -69,7 +69,7 @@ FORCEINLINE constexpr size_t GetTypeHash(T A) if constexpr (sizeof(T) == 8) return GetTypeHash(*reinterpret_cast(&A)); if constexpr (sizeof(T) == 16) return GetTypeHash(*reinterpret_cast(&A) ^ *(reinterpret_cast(&A) + 1)); else check_no_entry(); - + return INDEX_NONE; } @@ -84,7 +84,7 @@ FORCEINLINE constexpr size_t GetTypeHash(T A) template requires (CPointer || CSameAs) FORCEINLINE constexpr size_t GetTypeHash(T A) { - return GetTypeHash(reinterpret_cast(A)); + return GetTypeHash(reinterpret_cast(A)); } /** Overloads the GetTypeHash algorithm for T::hash_code(). */