diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 2d37bb5f3..df30be324 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -650,6 +650,33 @@ template using conditional_t = typename std::conditional::type; # endif +template +struct integers_of_size { }; +template <> +struct integers_of_size +{ + typedef int8_t i; + typedef uint8_t u; +}; +template <> +struct integers_of_size +{ + typedef int16_t i; + typedef uint16_t u; +}; +template <> +struct integers_of_size +{ + typedef int32_t i; + typedef uint32_t u; +}; +template <> +struct integers_of_size +{ + typedef int64_t i; + typedef uint64_t u; +}; + #endif @@ -666,6 +693,15 @@ private: }; #endif +#if CXXSTD >= 2011 +using native_t = typename integers_of_size::i; +using unative_t = typename integers_of_size::u; +#else +typedef ssize_t native_t; +typedef size_t unative_t; +#endif +EDUKE32_STATIC_ASSERT(sizeof(native_t) == sizeof(unative_t)); + typedef struct { int32_t x, y; } vec2_t;