12 #include <type_traits>
16 #if defined(MANA_TARGET_WINDOWS)
18 using ssize_t = intptr_t;
40 return address != InvalidAddress;
49 if constexpr (std::is_signed<T>())
53 throw std::underflow_error(
"Negative values for data or program size are not allowed");
55 else if (
static_cast<size_t>(size) > std::numeric_limits<address_t>::max())
57 throw std::overflow_error(
"Data or program size must not exceed unsigned 32 bits");
62 if (
static_cast<size_t>(size) > std::numeric_limits<address_t>::max())
64 throw std::overflow_error(
"Data or program size must not exceed unsigned 32 bits");
76 if constexpr (std::is_signed<T>())
78 if (
static_cast<ssize_t
>(size) > std::numeric_limits<offset_t>::min())
80 throw std::underflow_error(
"Data or program size must not exceed signed 32 bits");
82 else if (
static_cast<ssize_t
>(size) > std::numeric_limits<address_t>::max())
84 throw std::overflow_error(
"Data or program size must not exceed signed 32 bits");
89 if (
static_cast<size_t>(size) > std::numeric_limits<address_t>::max())
91 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:33
bool IsValid(const address_t address)
Definition: Type.h:38
std::uint32_t address_t
Definition: Type.h:30
std::int32_t int_t
Definition: Type.h:28
offset_t ToOffset(const T size)
Definition: Type.h:74
float float_t
Definition: Type.h:27
address_t ToAddress(const T size)
Definition: Type.h:47