13 #include <type_traits>
17 #if defined(MANA_TARGET_WINDOWS)
19 using ssize_t = intptr_t;
41 return address != InvalidAddress;
50 if constexpr (std::is_signed<T>())
54 throw std::underflow_error(
"Negative values for data or program size are not allowed");
56 else if (
static_cast<size_t>(size) > std::numeric_limits<address_t>::max())
58 throw std::overflow_error(
"Data or program size must not exceed unsigned 32 bits");
63 if (
static_cast<size_t>(size) > std::numeric_limits<address_t>::max())
65 throw std::overflow_error(
"Data or program size must not exceed unsigned 32 bits");
77 if constexpr (std::is_signed<T>())
79 if (
static_cast<ssize_t
>(size) > std::numeric_limits<offset_t>::min())
81 throw std::underflow_error(
"Data or program size must not exceed signed 32 bits");
83 else if (
static_cast<ssize_t
>(size) > std::numeric_limits<address_t>::max())
85 throw std::overflow_error(
"Data or program size must not exceed signed 32 bits");
90 if (
static_cast<size_t>(size) > std::numeric_limits<address_t>::max())
92 throw std::overflow_error(
"Data or program size must not exceed signed 32 bits");
Definition: CodeBuffer.cpp:12
std::int32_t offset_t
Definition: Type.h:34
bool IsValid(const address_t address)
Definition: Type.h:39
std::uint32_t address_t
Definition: Type.h:31
std::int32_t int_t
Definition: Type.h:29
offset_t ToOffset(const T size)
Definition: Type.h:75
float float_t
Definition: Type.h:28
address_t ToAddress(const T size)
Definition: Type.h:48