From: "Gabriel F. T. Gomes" <gabriel@inconstante.net.br>
To: <libc-alpha@sourceware.org>
Subject: [PATCH 22/31] Refactor *cvt functions implementation (3/5)
Date: Tue, 15 Oct 2019 19:07:00 -0000 [thread overview]
Message-ID: <20191015190529.11559-23-gabriel@inconstante.net.br> (raw)
In-Reply-To: <20191015190529.11559-1-gabriel@inconstante.net.br>
From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>
This patch is to be squashed with the other n/5 refactoring patches.
This patch only moves and merges the contents of misc/qefgcvt.c and
misc/qefgcvt_r.c into misc/efgcvt-ldbl-macros.h.
---
misc/efgcvt-ldbl-macros.h | 59 +++++++++++++++++++++++++++++++++++++++
misc/qefgcvt.c | 27 ------------------
misc/qefgcvt_r.c | 37 ------------------------
3 files changed, 59 insertions(+), 64 deletions(-)
create mode 100644 misc/efgcvt-ldbl-macros.h
diff --git a/misc/efgcvt-ldbl-macros.h b/misc/efgcvt-ldbl-macros.h
new file mode 100644
index 0000000000..ff97b13d7f
--- /dev/null
+++ b/misc/efgcvt-ldbl-macros.h
@@ -0,0 +1,59 @@
+/* Macros for the implementation of *cvt functions, long double version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <float.h>
+
+#define FLOAT_TYPE long double
+#define FUNC_PREFIX q
+#define FLOAT_FMT_FLAG "L"
+#define FLOAT_NAME_EXT l
+#define FLOAT_MIN_10_EXP LDBL_MIN_10_EXP
+/* Actually we have to write (LDBL_DIG + log10 (LDBL_MAX_10_EXP)) but
+ we don't have log10 available in the preprocessor. Since we cannot
+ assume anything on the used `long double' format be generous. */
+#define MAXDIG (NDIGIT_MAX + 12)
+#define FCVT_MAXDIG (LDBL_MAX_10_EXP + MAXDIG)
+#if LDBL_MANT_DIG == 64
+# define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 106
+# define NDIGIT_MAX 34
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
+#else
+/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
+ compile time constant here, so we cannot use it. */
+# error "NDIGIT_MAX must be precomputed"
+# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
+#endif
+#if LDBL_MIN_10_EXP == -37
+# define FLOAT_MIN_10_NORM 1.0e-37L
+#elif LDBL_MIN_10_EXP == -291
+# define FLOAT_MIN_10_NORM 1.0e-291L
+#elif LDBL_MIN_10_EXP == -307
+# define FLOAT_MIN_10_NORM 1.0e-307L
+#elif LDBL_MIN_10_EXP == -4931
+# define FLOAT_MIN_10_NORM 1.0e-4931L
+#else
+/* libc can't depend on libm. */
+# error "FLOAT_MIN_10_NORM must be precomputed"
+# define FLOAT_MIN_10_NORM exp10l (LDBL_MIN_10_EXP)
+#endif
diff --git a/misc/qefgcvt.c b/misc/qefgcvt.c
index 4fcadfcdc2..6987fb0db1 100644
--- a/misc/qefgcvt.c
+++ b/misc/qefgcvt.c
@@ -16,31 +16,4 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <float.h>
-
-#define FLOAT_TYPE long double
-#define FUNC_PREFIX q
-#define FLOAT_FMT_FLAG "L"
-/* Actually we have to write (LDBL_DIG + log10 (LDBL_MAX_10_EXP)) but
- we don't have log10 available in the preprocessor. Since we cannot
- assume anything on the used `long double' format be generous. */
-#define MAXDIG (NDIGIT_MAX + 12)
-#define FCVT_MAXDIG (LDBL_MAX_10_EXP + MAXDIG)
-#if LDBL_MANT_DIG == 64
-# define NDIGIT_MAX 21
-#elif LDBL_MANT_DIG == 53
-# define NDIGIT_MAX 17
-#elif LDBL_MANT_DIG == 113
-# define NDIGIT_MAX 36
-#elif LDBL_MANT_DIG == 106
-# define NDIGIT_MAX 34
-#elif LDBL_MANT_DIG == 56
-# define NDIGIT_MAX 18
-#else
-/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
- compile time constant here, so we cannot use it. */
-# error "NDIGIT_MAX must be precomputed"
-# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
-#endif
-
#include "efgcvt.c"
diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c
index 8f4d8b9f7a..e1f074b49c 100644
--- a/misc/qefgcvt_r.c
+++ b/misc/qefgcvt_r.c
@@ -17,41 +17,4 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <float.h>
-
-#define FLOAT_TYPE long double
-#define FUNC_PREFIX q
-#define FLOAT_FMT_FLAG "L"
-#define FLOAT_NAME_EXT l
-#define FLOAT_MIN_10_EXP LDBL_MIN_10_EXP
-#if LDBL_MANT_DIG == 64
-# define NDIGIT_MAX 21
-#elif LDBL_MANT_DIG == 53
-# define NDIGIT_MAX 17
-#elif LDBL_MANT_DIG == 113
-# define NDIGIT_MAX 36
-#elif LDBL_MANT_DIG == 106
-# define NDIGIT_MAX 34
-#elif LDBL_MANT_DIG == 56
-# define NDIGIT_MAX 18
-#else
-/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
- compile time constant here, so we cannot use it. */
-# error "NDIGIT_MAX must be precomputed"
-# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
-#endif
-#if LDBL_MIN_10_EXP == -37
-# define FLOAT_MIN_10_NORM 1.0e-37L
-#elif LDBL_MIN_10_EXP == -291
-# define FLOAT_MIN_10_NORM 1.0e-291L
-#elif LDBL_MIN_10_EXP == -307
-# define FLOAT_MIN_10_NORM 1.0e-307L
-#elif LDBL_MIN_10_EXP == -4931
-# define FLOAT_MIN_10_NORM 1.0e-4931L
-#else
-/* libc can't depend on libm. */
-# error "FLOAT_MIN_10_NORM must be precomputed"
-# define FLOAT_MIN_10_NORM exp10l (LDBL_MIN_10_EXP)
-#endif
-
#include "efgcvt_r.c"
--
2.21.0
next prev parent reply other threads:[~2019-10-15 19:07 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 19:05 [PATCH 00/31] Add IEEE long double <-> string functions for powerpc64le Gabriel F. T. Gomes
2019-10-15 19:05 ` [PATCH 01/31] ldbl-128ibm-compat: Add regular character printing functions Gabriel F. T. Gomes
2019-10-15 19:05 ` [PATCH 02/31] ldbl-128ibm-compat: Add wide " Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 03/31] ldbl-128ibm-compat: Add regular character, fortified " Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 11/31] ldbl-128ibm-compat: Add error.h functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 07/31] ldbl-128ibm-compat: Add regular character scanning functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 06/31] ldbl-128ibm-compat: Test positional arguments Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 10/31] ldbl-128ibm-compat: Add err.h functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 05/31] ldbl-128ibm-compat: Test double values Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 08/31] ldbl-128ibm-compat: Add wide character scanning functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 12/31] ldbl-128ibm-compat: Reuse tests for err.h and error.h functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 04/31] ldbl-128ibm-compat: Add wide character, fortified printing functions Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 23/31] Refactor *cvt functions implementation (4/5) Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 17/31] ldbl-128ibm-compat: Add tests for strfmon and strfmon_l Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 20/31] Refactor *cvt functions implementation (1/5) Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 16/31] ldbl-128ibm-compat: Add strfmon_l with IEEE long double format Gabriel F. T. Gomes
2019-10-15 19:07 ` Gabriel F. T. Gomes [this message]
2019-10-15 19:07 ` [PATCH 21/31] Refactor *cvt functions implementation (2/5) Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 13/31] ldbl-128ibm-compat: Add ISO C99 versions of scanf functions Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 14/31] ldbl-128ibm-compat: Add obstack printing functions Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 19/31] Remove hidden_def and hidden_proto from cvt functions Gabriel F. T. Gomes
2019-10-21 1:55 ` Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 15/31] ldbl-128ibm-compat: Add syslog functions Gabriel F. T. Gomes
2019-10-15 20:59 ` Joseph Myers
2019-10-21 1:51 ` Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 18/31] ldbl-128ibm-compat: Add tests for strfroml, strtold, and wcstold Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 09/31] ldbl-128ibm-compat: Add argp_error and argp_failure Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 30/31] powerpc64le: Require a compiler with -mno-gnu-attribute Gabriel F. T. Gomes
2019-10-15 21:11 ` Joseph Myers
2019-10-15 19:08 ` [PATCH 31/31] RFC: powerpc64le: Enable support for IEEE long double Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 27/31] ldbl-128ibm-compat: Compiler flags for stdio functions Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 29/31] ldbl-128ibm-compat: Do not mix -mabi=*longdouble and -mlong-double-128 Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 25/31] ldbl-128ibm-compat: Add *cvt functions Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 26/31] Do not redirect calls to __GI_* symbols, when redirecting to *ieee128 Gabriel F. T. Gomes
2019-10-16 3:57 ` Florian Weimer
2019-10-21 1:49 ` Gabriel F. T. Gomes
2019-10-21 10:13 ` Florian Weimer
2019-10-15 19:08 ` [PATCH 24/31] Refactor *cvt functions implementation (5/5) Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 28/31] Avoid compat symbols for totalorder in powerpc64le IEEE long double Gabriel F. T. Gomes
2019-10-15 21:08 ` Joseph Myers
2019-10-21 1:50 ` Gabriel F. T. Gomes
2019-10-21 14:59 ` Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191015190529.11559-23-gabriel@inconstante.net.br \
--to=gabriel@inconstante.net.br \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).