From 80dd6282f51561cafc2790b5ce4d99939430c744 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 16 Mar 2019 14:28:11 -0500 Subject: [PATCH] [ox/std] Add integer size templates --- deps/ox/src/ox/std/types.hpp | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/deps/ox/src/ox/std/types.hpp b/deps/ox/src/ox/std/types.hpp index dafc54bf..2a2e3f1e 100644 --- a/deps/ox/src/ox/std/types.hpp +++ b/deps/ox/src/ox/std/types.hpp @@ -48,6 +48,65 @@ typedef uint32_t uintptr_t; #endif +namespace ox { + +template +struct SignedType { +}; + +template<> +struct SignedType<8> { + using type = int8_t; +}; + +template<> +struct SignedType<16> { + using type = int16_t; +}; + +template<> +struct SignedType<32> { + using type = int32_t; +}; + +template<> +struct SignedType<64> { + using type = int64_t; +}; + + +template +struct UnsignedType { +}; + +template<> +struct UnsignedType<8> { + using type = uint8_t; +}; + +template<> +struct UnsignedType<16> { + using type = uint16_t; +}; + +template<> +struct UnsignedType<32> { + using type = uint32_t; +}; + +template<> +struct UnsignedType<64> { + using type = uint64_t; +}; + +template +using Int = typename SignedType::type; + +template +using Uint = typename UnsignedType::type; + +} + namespace std {