diff options
author | Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> | 2019-07-11 11:48:08 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> | 2019-12-23 16:30:24 -0300 |
commit | e18a305777adf60c2378ac864a350319269a29fa (patch) | |
tree | bfcc2067d12d938016ef7545faa52bcb24310400 /misc/qefgcvt.c | |
parent | 57e687c6d459edba77efe360014d4adec97d1a5c (diff) | |
download | glibc-e18a305777adf60c2378ac864a350319269a29fa.zip glibc-e18a305777adf60c2378ac864a350319269a29fa.tar.gz glibc-e18a305777adf60c2378ac864a350319269a29fa.tar.bz2 |
Refactor *cvt functions implementation (1/2)
This patch refactors the *cvt functions implementation in a way that
makes it easier to re-use them for implementing the IEEE long double on
powerpc64le. By splitting the implementation per se in one file
(efgcvt-template.c) and the alias definitions in others (e.g. efgcvt.c),
the new code makes it easier to define new function names, such as
__qecvtieee128.
Tested that installed stripped binaries for all build-many-glibcs
targets remain identical before and after this patch. Also tested for
powerpc64le and x86_64.
Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
Diffstat (limited to 'misc/qefgcvt.c')
-rw-r--r-- | misc/qefgcvt.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/misc/qefgcvt.c b/misc/qefgcvt.c index 4fcadfc..8f1582a 100644 --- a/misc/qefgcvt.c +++ b/misc/qefgcvt.c @@ -16,31 +16,19 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <float.h> +#include <efgcvt-ldbl-macros.h> +#include <efgcvt-template.c> -#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 +#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +# define cvt_symbol(symbol) \ + cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ + APPEND (FUNC_PREFIX, symbol), GLIBC_2_4) +# define cvt_symbol_1(lib, local, symbol, version) \ + versioned_symbol (lib, local, symbol, version) #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))) +# define cvt_symbol(symbol) \ + strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) #endif - -#include "efgcvt.c" +cvt_symbol(fcvt); +cvt_symbol(ecvt); +cvt_symbol(gcvt); |