From b9bd89914feebe8c0c1ca519470771039a9b7692 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 5 Oct 2019 00:56:43 -0400 Subject: [PATCH] Add back _EM_LSIZE == 8 to This will cause ACK libc to provide int64_t as long (instead of long long) on LP64, if we ever get such a platform. LP64 would have 64-bit long and 64-bit long long, so int64_t might be either type. For example on amd64, int64_t is long in NetBSD libc, and long long in OpenBSD libc. Support for long long in ACK remains incomplete (no printf "%lld"), so it seems better to prefer long where possible. Also, int64_t being long before long long is more consistent with int32_t being int before long. Put suffixes on the values of INT32_MAX, INT64_MAX, and related constants, so they have the same types as int32_t and int64_t. --- lang/cem/libcc.ansi/headers/stdint.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lang/cem/libcc.ansi/headers/stdint.h b/lang/cem/libcc.ansi/headers/stdint.h index e21b48d7a..cd10049b9 100644 --- a/lang/cem/libcc.ansi/headers/stdint.h +++ b/lang/cem/libcc.ansi/headers/stdint.h @@ -27,17 +27,29 @@ typedef unsigned short uint16_t; #if _EM_WSIZE == 4 typedef signed int int32_t; typedef unsigned int uint32_t; -#else -typedef signed long int32_t; -typedef unsigned long uint32_t; -#endif #define INT32_MAX 2147483647 #define INT32_MIN (-2147483648) #define UINT32_MAX 4294967295U +#else +typedef signed long int32_t; +typedef unsigned long uint32_t; +#define INT32_MAX 2147483647L +#define INT32_MIN (-2147483648L) +#define UINT32_MAX 4294967295UL +#endif -/* We only get int64_t if long longs are 8 bytes. */ +/* We only get int64_t if longs or long longs are 8 bytes. */ -#if _EM_LLSIZE == 8 +#if _EM_LSIZE == 8 +typedef signed long int64_t; +typedef unsigned long uint64_t; +#define INT64_MAX 9223372036854775807L +#define INT64_MIN (-9223372036854775808L) +#define UINT64_MAX 18446744073709551615UL + +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; +#elif _EM_LLSIZE == 8 typedef signed long long int64_t; typedef unsigned long long uint64_t; #define INT64_MAX 9223372036854775807LL