File 0360-big.h-Eliminate-the-BIG_DIGITS_PER_WORD-define.patch of Package erlang

From f50b72d5bb02bcba3864004230d34b69af4923c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 28 Jan 2021 10:16:38 +0100
Subject: [PATCH 4/4] big.h: Eliminate the BIG_DIGITS_PER_WORD define

BIG_DIGITS_PER_WORD is defined as:

    #define BIG_DIGITS_PER_WORD (sizeof(Uint)/sizeof(ErtsDigit))

This value now always evaluates to 1, because ErtsDigit is defined as:

    typedef Uint ErtsDigit;
---
 erts/emulator/beam/big.c           | 3 ---
 erts/emulator/beam/big.h           | 1 -
 erts/emulator/beam/erl_bif_guard.c | 3 ---
 3 files changed, 7 deletions(-)

diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index f3a5db5c52..ddaceecbf7 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1706,9 +1706,6 @@ double_to_big(double x, Eterm *heap, Uint hsz)
 	xp[i] = d; /* store digit */
 	x -= d; /* remove integer part */
     }
-    while ((ds & (BIG_DIGITS_PER_WORD - 1)) != 0) {
-	xp[ds++] = 0;
-    }
 
     if (is_negative) {
 	*hp = make_neg_bignum_header(sz-1);
diff --git a/erts/emulator/beam/big.h b/erts/emulator/beam/big.h
index 005f34fdd9..fade06eb73 100644
--- a/erts/emulator/beam/big.h
+++ b/erts/emulator/beam/big.h
@@ -64,7 +64,6 @@ typedef Uint  dsize_t;	 /* Vector size type */
 #define BIG_SIGN(xp)     (!!bignum_header_is_neg(*xp))
 #define BIG_ARITY(xp)    ((Uint)bignum_header_arity(*(xp)))
 #define BIG_DIGIT(xp,i)  *(BIG_V(xp)+(i))
-#define BIG_DIGITS_PER_WORD (sizeof(Uint)/sizeof(ErtsDigit))
 
 #define BIG_SIZE(xp)  BIG_ARITY(xp)
 
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c
index 4d3fbfcfb7..2730b99ba4 100644
--- a/erts/emulator/beam/erl_bif_guard.c
+++ b/erts/emulator/beam/erl_bif_guard.c
@@ -431,9 +431,6 @@ double_to_integer(Process* p, double x)
 	xp[i] = d;        /* store digit */
 	x -= d;           /* remove integer part */
     }
-    while ((ds & (BIG_DIGITS_PER_WORD-1)) != 0) {
-	xp[ds++] = 0;
-    }
 
     if (is_negative) {
 	*hp = make_neg_bignum_header(sz-1);
-- 
2.26.2

openSUSE Build Service is sponsored by