File 6541-Optimize-bignum-arithmetic-on-64-bit-platforms.patch of Package erlang
From b9e1377c5547eb87a9e36f635b1187ff06493d39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 19 Jun 2023 05:48:02 +0200
Subject: [PATCH 1/6] Optimize bignum arithmetic on 64-bit platforms
When compiling 64-bit programs, goth gcc and clang support an 128-bit
unsigned integer type. Using it to define the `ErtsDoubleDigit` type
will speed up multiplication and division.
---
erts/emulator/beam/big.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/erts/emulator/beam/big.h b/erts/emulator/beam/big.h
index b2320f59ac..e04749417f 100644
--- a/erts/emulator/beam/big.h
+++ b/erts/emulator/beam/big.h
@@ -37,8 +37,11 @@ typedef Uint16 ErtsHalfDigit;
#undef BIG_HAVE_DOUBLE_DIGIT
typedef Uint16 ErtsHalfDigit;
+#elif (SIZEOF_VOID_P == 8) && defined(__GNUC__) && (__GNUC__ >= 4)
+typedef __uint128_t ErtsDoubleDigit;
+#define BIG_HAVE_DOUBLE_DIGIT 1
+
#elif (SIZEOF_VOID_P == 8)
-/* Assume 64-bit machine, does it exist 128 bit long long long ? */
#undef BIG_HAVE_DOUBLE_DIGIT
typedef Uint32 ErtsHalfDigit;
#else
--
2.35.3