From 6db4a3191667104d731f9438bef3403fdf36a558 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 13 Apr 2018 07:41:03 -0500 Subject: [PATCH] [ox/std] Make types use cstdint if OX_USE_STDLIB is enabled --- deps/ox/src/ox/std/types.hpp | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/deps/ox/src/ox/std/types.hpp b/deps/ox/src/ox/std/types.hpp index fbd44096..377f054e 100644 --- a/deps/ox/src/ox/std/types.hpp +++ b/deps/ox/src/ox/std/types.hpp @@ -8,6 +8,12 @@ #pragma once +#if OX_USE_STDLIB + +#include + +#else + typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; @@ -15,7 +21,7 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; -#if defined(_WIN32) || defined(__APPLE__) || defined(__arm__) || defined(__ppc__) +#if defined(__arm__) || defined(__ppc__) typedef long long int64_t; typedef unsigned long long uint64_t; typedef __INTMAX_TYPE__ intmax_t; @@ -27,6 +33,23 @@ typedef int64_t intmax_t; typedef uint64_t uintmax_t; #endif +#if defined(_LP64) || defined(__ppc64__) || defined(__aarch64__) +typedef long intptr_t; +typedef unsigned long uintptr_t; +#elif defined(_WIN64) +typedef int64_t intptr_t; +typedef uint64_t uintptr_t; +#elif defined(_LP32) || defined(__ppc__) || defined(_WIN32) || defined(__arm__) +typedef int32_t intptr_t; +typedef uint32_t uintptr_t; +#else +#error intptr_t, and uintptr_t undefined +#endif + +#endif + + + namespace ox { using Error = uint32_t; @@ -55,19 +78,6 @@ struct ValErr { } -#if defined(_LP64) || defined(__ppc64__) || defined(__aarch64__) -typedef long intptr_t; -typedef unsigned long uintptr_t; -#elif defined(_WIN64) -typedef int64_t intptr_t; -typedef uint64_t uintptr_t; -#elif defined(_LP32) || defined(__ppc__) || defined(_WIN32) || defined(__arm__) -typedef int32_t intptr_t; -typedef uint32_t uintptr_t; -#else -#error intptr_t, and uintptr_t undefined -#endif - namespace std { using nullptr_t = decltype(nullptr);