summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2023-09-04 17:54:22 +0200
committerRichard Levitte <levitte@openssl.org>2023-09-04 18:27:21 +0200
commit09a4b4b72204f973804d60096c513f5ed6b39e4f (patch)
treefd88b10d165c74bcdf7ac2bbda67b37df1ae4bf7
parentcfbdc5dd14bf9fc969c9eb76216ab59a4ae64ba4 (diff)
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 <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21951)
-rw-r--r--include/internal/numbers.h25
-rw-r--r--test/quic_multistream_test.c1
2 files changed, 26 insertions, 0 deletions
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;