From 09a4b4b72204f973804d60096c513f5ed6b39e4f Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 4 Sep 2023 17:54:22 +0200 Subject: internal/numbers.h: Add fallback implementation for UINT32_C and UINT64_C Other similar macros can be implemented later. Right now, this are the most likely to be actually useful Reviewed-by: Dmitry Belyavskiy Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/21951) --- include/internal/numbers.h | 25 +++++++++++++++++++++++++ test/quic_multistream_test.c | 1 + 2 files changed, 26 insertions(+) diff --git a/include/internal/numbers.h b/include/internal/numbers.h index 4f4d3306d5..41fd693bd1 100644 --- a/include/internal/numbers.h +++ b/include/internal/numbers.h @@ -61,6 +61,31 @@ # define UINT64_MAX __MAXUINT__(uint64_t) # endif +/* + * 64-bit processor with LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT_LONG +# ifndef UINT32_C +# define UINT32_C(c) (c) +# endif +# ifndef UINT64_C +# define UINT64_C(c) (c##UL) +# endif +# endif + +/* + * 64-bit processor other than LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT +# ifndef UINT32_C +# define UINT32_C(c) (c##UL) +# endif +# ifndef UINT64_C +# define UINT64_C(c) (c##ULL) +# endif +# endif + + # ifndef INT128_MAX # if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ == 16 typedef __int128_t int128_t; diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 895a6d74a7..04f2771ed8 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -18,6 +18,7 @@ #if defined(OPENSSL_THREADS) # include "internal/thread_arch.h" #endif +#include "internal/numbers.h" /* UINT64_C */ static const char *certfile, *keyfile; -- cgit v1.2.3