refactor(miscellaneous): renamed builtin type, add fixed-width character type
This commit is contained in:
parent
a086f90f25
commit
bb89dd6509
@ -14,7 +14,7 @@ FORCEINLINE constexpr T Align(T InValue, size_t Alignment)
|
|||||||
{
|
{
|
||||||
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "Align expects an integer or pointer type");
|
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "Align expects an integer or pointer type");
|
||||||
|
|
||||||
return (T)(((uintptr_t)(InValue) + static_cast<uintptr_t>(Alignment) - 1) & ~(static_cast<uintptr_t>(Alignment) - 1));
|
return (T)(((uintptr)(InValue) + static_cast<uintptr>(Alignment) - 1) & ~(static_cast<uintptr>(Alignment) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -22,7 +22,7 @@ FORCEINLINE constexpr T AlignDown(T InValue, size_t Alignment)
|
|||||||
{
|
{
|
||||||
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "AlignDown expects an integer or pointer type");
|
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "AlignDown expects an integer or pointer type");
|
||||||
|
|
||||||
return (T)((uintptr_t)(InValue) & ~(static_cast<uintptr_t>(Alignment) - 1));
|
return (T)((uintptr)(InValue) & ~(static_cast<uintptr>(Alignment) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -30,7 +30,7 @@ FORCEINLINE constexpr T AlignArbitrary(T InValue, size_t Alignment)
|
|||||||
{
|
{
|
||||||
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "AlignArbitrary expects an integer or pointer type");
|
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "AlignArbitrary expects an integer or pointer type");
|
||||||
|
|
||||||
return (T)((((uintptr_t)(InValue) + static_cast<uintptr_t>(Alignment) - 1) / static_cast<uintptr_t>(Alignment)) * static_cast<uintptr_t>(Alignment));
|
return (T)((((uintptr)(InValue) + static_cast<uintptr>(Alignment) - 1) / static_cast<uintptr>(Alignment)) * static_cast<uintptr>(Alignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -38,7 +38,7 @@ FORCEINLINE constexpr bool IsAligned(T InValue, size_t Alignment)
|
|||||||
{
|
{
|
||||||
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "IsAligned expects an integer or pointer type");
|
static_assert(TIsIntegral<T>::Value || TIsPointer<T>::Value, "IsAligned expects an integer or pointer type");
|
||||||
|
|
||||||
return !((uintptr_t)(InValue) & (static_cast<uintptr_t>(Alignment) - 1));
|
return !((uintptr)(InValue) & (static_cast<uintptr>(Alignment) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
NAMESPACE_END(Memory)
|
NAMESPACE_END(Memory)
|
||||||
|
@ -17,7 +17,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
#define NO_UNIQUE_ADDRESS [[no_unique_address]]
|
#define NO_UNIQUE_ADDRESS [[no_unique_address]]
|
||||||
|
|
||||||
constexpr size_t INDEX_NONE = -1;
|
constexpr size_t INDEX_NONE = -1;
|
||||||
constexpr WIDECHAR UNICODE_BOM = 0xfeff;
|
constexpr charw UNICODE_BOM = 0xfeff;
|
||||||
|
|
||||||
struct FForceInit { explicit FForceInit() = default; };
|
struct FForceInit { explicit FForceInit() = default; };
|
||||||
struct FNoInit { explicit FNoInit() = default; };
|
struct FNoInit { explicit FNoInit() = default; };
|
||||||
|
@ -68,25 +68,25 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
|
|
||||||
# define VARARGS __cdecl
|
# define VARARGS __cdecl
|
||||||
# define CDECL __cdecl
|
# define CDECL __cdecl
|
||||||
# define STDCALL __stdcall
|
# define STDCALL __stdcall
|
||||||
# define FORCEINLINE __forceinline
|
# define FORCEINLINE __forceinline
|
||||||
# define FORCENOINLINE __declspec(noinline)
|
# define FORCENOINLINE __declspec(noinline)
|
||||||
# define RESTRICT __restrict
|
# define RESTRICT __restrict
|
||||||
|
|
||||||
#elif PLATFORM_LINUX
|
#elif PLATFORM_LINUX
|
||||||
|
|
||||||
# define VARARGS
|
# define VARARGS
|
||||||
# define CDECL
|
# define CDECL
|
||||||
# define STDCALL
|
# define STDCALL
|
||||||
# define FORCENOINLINE __attribute__((noinline))
|
# define FORCENOINLINE __attribute__((noinline))
|
||||||
# define RESTRICT __restrict
|
# define RESTRICT __restrict
|
||||||
|
|
||||||
# if BUILD_DEBUG
|
# if BUILD_DEBUG
|
||||||
# define FORCEINLINE inline
|
# define FORCEINLINE inline
|
||||||
# else
|
# else
|
||||||
# define FORCEINLINE inline __attribute__ ((always_inline))
|
# define FORCEINLINE inline __attribute__ ((always_inline))
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -96,7 +96,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
# define STDCALL
|
# define STDCALL
|
||||||
# define FORCEINLINE
|
# define FORCEINLINE
|
||||||
# define FORCENOINLINE
|
# define FORCENOINLINE
|
||||||
# define RESTRICT __restrict
|
# define RESTRICT __restrict
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -104,13 +104,13 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
|
|
||||||
# define DLLEXPORT __declspec(dllexport)
|
# define DLLEXPORT __declspec(dllexport)
|
||||||
# define DLLIMPORT __declspec(dllimport)
|
# define DLLIMPORT __declspec(dllimport)
|
||||||
|
|
||||||
#elif PLATFORM_LINUX
|
#elif PLATFORM_LINUX
|
||||||
|
|
||||||
# define DLLEXPORT __attribute__((visibility("default")))
|
# define DLLEXPORT __attribute__((visibility("default")))
|
||||||
# define DLLIMPORT __attribute__((visibility("default")))
|
# define DLLIMPORT __attribute__((visibility("default")))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -121,31 +121,34 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
|
|
||||||
// Unsigned base types.
|
// Unsigned base types.
|
||||||
|
|
||||||
typedef NAMESPACE_STD::uint8_t uint8;
|
typedef NAMESPACE_STD::uint8_t uint8;
|
||||||
typedef NAMESPACE_STD::uint16_t uint16;
|
typedef NAMESPACE_STD::uint16_t uint16;
|
||||||
typedef NAMESPACE_STD::uint32_t uint32;
|
typedef NAMESPACE_STD::uint32_t uint32;
|
||||||
typedef NAMESPACE_STD::uint64_t uint64;
|
typedef NAMESPACE_STD::uint64_t uint64;
|
||||||
|
|
||||||
// Signed base types.
|
// Signed base types.
|
||||||
|
|
||||||
typedef NAMESPACE_STD::int8_t int8;
|
typedef NAMESPACE_STD::int8_t int8;
|
||||||
typedef NAMESPACE_STD::int16_t int16;
|
typedef NAMESPACE_STD::int16_t int16;
|
||||||
typedef NAMESPACE_STD::int32_t int32;
|
typedef NAMESPACE_STD::int32_t int32;
|
||||||
typedef NAMESPACE_STD::int64_t int64;
|
typedef NAMESPACE_STD::int64_t int64;
|
||||||
|
|
||||||
// Character types.
|
// Character types.
|
||||||
|
|
||||||
typedef char ANSICHAR;
|
typedef char chara;
|
||||||
typedef wchar_t WIDECHAR;
|
typedef wchar_t charw;
|
||||||
typedef WIDECHAR TCHAR;
|
typedef charw chart;
|
||||||
|
typedef char8_t char8;
|
||||||
|
typedef char16_t char16;
|
||||||
|
typedef char32_t char32;
|
||||||
|
|
||||||
// Pointer types.
|
// Pointer types.
|
||||||
|
|
||||||
typedef NAMESPACE_STD::uintptr_t uintptr_t;
|
typedef NAMESPACE_STD::uintptr_t uintptr;
|
||||||
typedef NAMESPACE_STD::intptr_t intptr_t;
|
typedef NAMESPACE_STD::intptr_t intptr;
|
||||||
typedef NAMESPACE_STD::ptrdiff_t ptrdiff_t;
|
typedef NAMESPACE_STD::ptrdiff_t ptrdiff;
|
||||||
typedef NAMESPACE_STD::size_t size_t;
|
typedef NAMESPACE_STD::size_t size_t;
|
||||||
typedef intptr_t ssize_t;
|
typedef intptr_t ssize_t;
|
||||||
|
|
||||||
// Null types.
|
// Null types.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user