From 9761bf4dfae04016bccaa82414719523b090dd60 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 16 May 2018 06:03:08 +0200 Subject: math: Merge strtod_nan_*.h into math-type-macros-*.h This change will eventually make it possible to compile stdlib/strtod_nan_main.c as part of math/s_nan_template.c. --- ChangeLog | 66 ++++++++++++++++++++++ manual/arith.texi | 2 +- stdlib/strtod_nan.c | 2 +- stdlib/strtod_nan_double.h | 30 ---------- stdlib/strtod_nan_float.h | 29 ---------- stdlib/strtod_nan_main.c | 2 +- stdlib/strtof_nan.c | 2 +- stdlib/strtold_nan.c | 2 +- sysdeps/generic/math-nan-payload-double.h | 29 ++++++++++ sysdeps/generic/math-nan-payload-float.h | 28 +++++++++ sysdeps/generic/math-type-macros-double.h | 3 +- sysdeps/generic/math-type-macros-float.h | 3 +- sysdeps/generic/math-type-macros-float128.h | 1 + sysdeps/generic/math-type-macros-ldouble.h | 3 +- sysdeps/generic/math-type-macros.h | 9 ++- .../ieee754/float128/math-nan-payload-float128.h | 34 +++++++++++ sysdeps/ieee754/float128/strtod_nan_float128.h | 33 ----------- sysdeps/ieee754/float128/strtof128_nan.c | 4 +- sysdeps/ieee754/float128/wcstof128_nan.c | 3 +- .../ieee754/ldbl-128/math-nan-payload-ldouble.h | 32 +++++++++++ sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h | 33 ----------- .../ieee754/ldbl-128ibm/math-nan-payload-ldouble.h | 29 ++++++++++ sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h | 30 ---------- sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h | 29 ++++++++++ sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h | 30 ---------- wcsmbs/wcstod_nan.c | 2 +- wcsmbs/wcstof_nan.c | 2 +- wcsmbs/wcstold_nan.c | 2 +- 28 files changed, 272 insertions(+), 202 deletions(-) delete mode 100644 stdlib/strtod_nan_double.h delete mode 100644 stdlib/strtod_nan_float.h create mode 100644 sysdeps/generic/math-nan-payload-double.h create mode 100644 sysdeps/generic/math-nan-payload-float.h create mode 100644 sysdeps/ieee754/float128/math-nan-payload-float128.h delete mode 100644 sysdeps/ieee754/float128/strtod_nan_float128.h create mode 100644 sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h delete mode 100644 sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h create mode 100644 sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h delete mode 100644 sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h create mode 100644 sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h delete mode 100644 sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h diff --git a/ChangeLog b/ChangeLog index 9e04684..88ffee6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,69 @@ +2018-05-16 Florian Weimer + + * stdlib/strtod_nan.c: Include instead + of . + * stdlib/strtod_nan_main.c (STRTOD_NAN): Use SET_NAN_PAYLOAD + instead of SET_MANTISSA. + * stdlib/strtof_nan.c: Include instead + of include . + * stdlib/strtold_nan.c: Include + instead of . + * stdlib/strtod_nan_double.h: Move to ... + * sysdeps/generic/math-nan-payload-double.h: ... here. + (FLOAT): Remove definition. + (SET_MANTISSA): Rename to ... + (SET_NAN_PAYLOAD): ... this. + * stdlib/strtod_nan_float.h: Move to ... + * sysdeps/generic/math-nan-payload-float.h: ... here. + (FLOAT): Remove definition. + (SET_MANTISSA): Rename to ... + (SET_NAN_PAYLOAD): ... this. + * sysdeps/generic/math-type-macros-double.h: Include + . Include + instead of . + * sysdeps/generic/math-type-macros-float.h: Include + . Include + instead of . + * sysdeps/generic/math-type-macros-float128.h: Include + . + * sysdeps/generic/math-type-macros-ldouble.h: Include + . Include + instead of . + * sysdeps/generic/math-type-macros.h: Document SET_NAN_PAYLOAD and + check for definition. + * sysdeps/ieee754/float128/strtod_nan_float128.h: Move to ... + * sysdeps/ieee754/float128/math-nan-payload-float128.h: ... here. + Include . + (FLOAT): Remove definition. + (SET_MANTISSA): Rename to ... + (SET_NAN_PAYLOAD): ... this. + * sysdeps/ieee754/float128/strtof128_nan.c: Include + instead of . + Do not include . + * sysdeps/ieee754/float128/wcstof128_nan.c: Likewise. + * sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Move to ... + * sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h: ... here. + (FLOAT): Remove definition. + (SET_MANTISSA): Rename to ... + (SET_NAN_PAYLOAD): ... this. + * sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Move to ... + * sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h: ... here. + (FLOAT): Remove definition. + (SET_MANTISSA): Rename to ... + (SET_NAN_PAYLOAD): ... this. + * sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Move to ... + * sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h: ... here. + (FLOAT): Remove definition. + (SET_MANTISSA): Rename to ... + (SET_NAN_PAYLOAD): ... this. + * wcsmbs/wcstod_nan.c: Include instead + of "../stdlib/strtod_nan_double.h". + * wcsmbs/wcstof_nan.c: Include instead + of "../stdlib/strtod_nan_float.h". + * wcsmbs/wcstold_nan.c: Include + instead of "../stdlib/strtod_nan_ldouble.h". + * manual/arith.texi (Parsing of Floats): Adjust comment. + 2018-05-16 Joseph Myers * math/Makefile (libm-narrow-fns): Add mul. diff --git a/manual/arith.texi b/manual/arith.texi index 3c5b69b..2764f69 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -2784,7 +2784,7 @@ as well. @c mpn_lshift_1 -> mpn_lshift ok @c STRTOF_INTERNAL @c MPN_VAR ok -@c SET_MANTISSA ok +@c SET_NAN_PAYLOAD ok @c STRNCASECMP ok, wide and narrow @c round_and_return ok @c mpn_mul ok diff --git a/stdlib/strtod_nan.c b/stdlib/strtod_nan.c index f64fec1..c5876b5 100644 --- a/stdlib/strtod_nan.c +++ b/stdlib/strtod_nan.c @@ -18,7 +18,7 @@ . */ #include -#include +#include #define STRTOD_NAN __strtod_nan #include diff --git a/stdlib/strtod_nan_double.h b/stdlib/strtod_nan_double.h deleted file mode 100644 index d76a03b..0000000 --- a/stdlib/strtod_nan_double.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For double. - Copyright (C) 1997-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 - . */ - -#define FLOAT double -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ieee754_double u; \ - u.d = (flt); \ - u.ieee_nan.mantissa0 = (mant) >> 32; \ - u.ieee_nan.mantissa1 = (mant); \ - if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \ - (flt) = u.d; \ - } \ - while (0) diff --git a/stdlib/strtod_nan_float.h b/stdlib/strtod_nan_float.h deleted file mode 100644 index 80249d6..0000000 --- a/stdlib/strtod_nan_float.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For float. - Copyright (C) 1997-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 - . */ - -#define FLOAT float -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ieee754_float u; \ - u.f = (flt); \ - u.ieee_nan.mantissa = (mant); \ - if (u.ieee.mantissa != 0) \ - (flt) = u.f; \ - } \ - while (0) diff --git a/stdlib/strtod_nan_main.c b/stdlib/strtod_nan_main.c index 12f6e73..80ecb78 100644 --- a/stdlib/strtod_nan_main.c +++ b/stdlib/strtod_nan_main.c @@ -52,7 +52,7 @@ STRTOD_NAN (const STRING_TYPE *str, STRING_TYPE **endptr, STRING_TYPE endc) mant = STRTOULL (str, &endp, 0); if (endp == cp) - SET_MANTISSA (retval, mant); + SET_NAN_PAYLOAD (retval, mant); out: if (endptr != NULL) diff --git a/stdlib/strtof_nan.c b/stdlib/strtof_nan.c index ea3decb..f085c5b 100644 --- a/stdlib/strtof_nan.c +++ b/stdlib/strtof_nan.c @@ -18,7 +18,7 @@ . */ #include -#include +#include #define STRTOD_NAN __strtof_nan #include diff --git a/stdlib/strtold_nan.c b/stdlib/strtold_nan.c index d4bbcc0..eadfe54 100644 --- a/stdlib/strtold_nan.c +++ b/stdlib/strtold_nan.c @@ -23,7 +23,7 @@ representation. */ #ifndef __NO_LONG_DOUBLE_MATH # include -# include +# include # define STRTOD_NAN __strtold_nan # include diff --git a/sysdeps/generic/math-nan-payload-double.h b/sysdeps/generic/math-nan-payload-double.h new file mode 100644 index 0000000..cfcc53a --- /dev/null +++ b/sysdeps/generic/math-nan-payload-double.h @@ -0,0 +1,29 @@ +/* NaN payload handling for double. + Copyright (C) 1997-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 + . */ + +#define SET_NAN_PAYLOAD(flt, mant) \ + do \ + { \ + union ieee754_double u; \ + u.d = (flt); \ + u.ieee_nan.mantissa0 = (mant) >> 32; \ + u.ieee_nan.mantissa1 = (mant); \ + if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \ + (flt) = u.d; \ + } \ + while (0) diff --git a/sysdeps/generic/math-nan-payload-float.h b/sysdeps/generic/math-nan-payload-float.h new file mode 100644 index 0000000..2a4ff8c --- /dev/null +++ b/sysdeps/generic/math-nan-payload-float.h @@ -0,0 +1,28 @@ +/* NaN payload handling for float. + Copyright (C) 1997-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 + . */ + +#define SET_NAN_PAYLOAD(flt, mant) \ + do \ + { \ + union ieee754_float u; \ + u.f = (flt); \ + u.ieee_nan.mantissa = (mant); \ + if (u.ieee.mantissa != 0) \ + (flt) = u.f; \ + } \ + while (0) diff --git a/sysdeps/generic/math-type-macros-double.h b/sysdeps/generic/math-type-macros-double.h index 1af4c74..1564182 100644 --- a/sysdeps/generic/math-type-macros-double.h +++ b/sysdeps/generic/math-type-macros-double.h @@ -27,6 +27,7 @@ #define CFLOAT _Complex double #define M_STRTO_NAN __strtod_nan +#include #include #ifndef declare_mgen_alias @@ -42,7 +43,7 @@ /* Do not use the type-generic wrapper templates if compatibility with SVID error handling is needed. */ -#include +#include #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT #endif diff --git a/sysdeps/generic/math-type-macros-float.h b/sysdeps/generic/math-type-macros-float.h index 9273bde..7dd0b74 100644 --- a/sysdeps/generic/math-type-macros-float.h +++ b/sysdeps/generic/math-type-macros-float.h @@ -30,6 +30,7 @@ the double macro constants. */ #define M_MLIT(c) c +#include #include #ifndef declare_mgen_alias @@ -45,7 +46,7 @@ /* Do not use the type-generic wrapper templates if compatibility with SVID error handling is needed. */ -#include +#include #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT #endif diff --git a/sysdeps/generic/math-type-macros-float128.h b/sysdeps/generic/math-type-macros-float128.h index 485c13b..6144bc0 100644 --- a/sysdeps/generic/math-type-macros-float128.h +++ b/sysdeps/generic/math-type-macros-float128.h @@ -29,6 +29,7 @@ #define M_MLIT(c) c ## f128 +#include #include #ifndef declare_mgen_alias diff --git a/sysdeps/generic/math-type-macros-ldouble.h b/sysdeps/generic/math-type-macros-ldouble.h index 5fe1600..db41199 100644 --- a/sysdeps/generic/math-type-macros-ldouble.h +++ b/sysdeps/generic/math-type-macros-ldouble.h @@ -27,6 +27,7 @@ #define CFLOAT _Complex long double #define M_STRTO_NAN __strtold_nan +#include #include #ifndef declare_mgen_alias @@ -42,7 +43,7 @@ /* Do not use the type-generic wrapper templates if compatibility with SVID error handling is needed. */ -#include +#include #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT #endif diff --git a/sysdeps/generic/math-type-macros.h b/sysdeps/generic/math-type-macros.h index ffcf7b8..0e8ef16 100644 --- a/sysdeps/generic/math-type-macros.h +++ b/sysdeps/generic/math-type-macros.h @@ -40,7 +40,11 @@ declare_mgen_alias_r(from,to) This exposes the appropriate symbol(s) for a - function f_r of type FLOAT. */ + function f_r of type FLOAT. + + SET_NAN_PAYLOAD(flt, mant) + Set the NaN payload bits of the variable FLT of type FLOAT to + the mantissa MANT. */ #ifndef M_PFX # error "M_PFX must be defined." @@ -66,6 +70,9 @@ #ifndef declare_mgen_alias_r # error "declare_mgen_alias_r must be defined." #endif +#ifndef SET_NAN_PAYLOAD +# error "SET_NAN_PAYLOAD must be defined." +#endif #define __M_CONCAT(a,b) a ## b #define __M_CONCATX(a,b) __M_CONCAT(a,b) diff --git a/sysdeps/ieee754/float128/math-nan-payload-float128.h b/sysdeps/ieee754/float128/math-nan-payload-float128.h new file mode 100644 index 0000000..95ab953 --- /dev/null +++ b/sysdeps/ieee754/float128/math-nan-payload-float128.h @@ -0,0 +1,34 @@ +/* NaN payload handling for _Float128. + Copyright (C) 2017-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 + . */ + +#include + +#define SET_NAN_PAYLOAD(flt, mant) \ + do \ + { \ + union ieee854_float128 u; \ + u.d = (flt); \ + u.ieee_nan.mantissa0 = 0; \ + u.ieee_nan.mantissa1 = 0; \ + u.ieee_nan.mantissa2 = (mant) >> 32; \ + u.ieee_nan.mantissa3 = (mant); \ + if ((u.ieee.mantissa0 | u.ieee.mantissa1 \ + | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \ + (flt) = u.d; \ + } \ + while (0) diff --git a/sysdeps/ieee754/float128/strtod_nan_float128.h b/sysdeps/ieee754/float128/strtod_nan_float128.h deleted file mode 100644 index c3eaca4..0000000 --- a/sysdeps/ieee754/float128/strtod_nan_float128.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For _Float128. - Copyright (C) 2017-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 - . */ - -#define FLOAT _Float128 -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ieee854_float128 u; \ - u.d = (flt); \ - u.ieee_nan.mantissa0 = 0; \ - u.ieee_nan.mantissa1 = 0; \ - u.ieee_nan.mantissa2 = (mant) >> 32; \ - u.ieee_nan.mantissa3 = (mant); \ - if ((u.ieee.mantissa0 | u.ieee.mantissa1 \ - | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \ - (flt) = u.d; \ - } \ - while (0) diff --git a/sysdeps/ieee754/float128/strtof128_nan.c b/sysdeps/ieee754/float128/strtof128_nan.c index 36a9bff..37a7f4e 100644 --- a/sysdeps/ieee754/float128/strtof128_nan.c +++ b/sysdeps/ieee754/float128/strtof128_nan.c @@ -19,10 +19,8 @@ #include -#include - #include -#include +#include #define STRTOD_NAN __strtof128_nan #include diff --git a/sysdeps/ieee754/float128/wcstof128_nan.c b/sysdeps/ieee754/float128/wcstof128_nan.c index ffc72a0..f504809 100644 --- a/sysdeps/ieee754/float128/wcstof128_nan.c +++ b/sysdeps/ieee754/float128/wcstof128_nan.c @@ -18,7 +18,6 @@ . */ #include -#include -#include +#include #define STRTOD_NAN __wcstof128_nan #include diff --git a/sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h b/sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h new file mode 100644 index 0000000..e2f092d --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h @@ -0,0 +1,32 @@ +/* NaN payload handling for ldbl-128. + Copyright (C) 1997-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 + . */ + +#define SET_NAN_PAYLOAD(flt, mant) \ + do \ + { \ + union ieee854_long_double u; \ + u.d = (flt); \ + u.ieee_nan.mantissa0 = 0; \ + u.ieee_nan.mantissa1 = 0; \ + u.ieee_nan.mantissa2 = (mant) >> 32; \ + u.ieee_nan.mantissa3 = (mant); \ + if ((u.ieee.mantissa0 | u.ieee.mantissa1 \ + | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \ + (flt) = u.d; \ + } \ + while (0) diff --git a/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h deleted file mode 100644 index 77d81ac..0000000 --- a/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For ldbl-128. - Copyright (C) 1997-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 - . */ - -#define FLOAT long double -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ieee854_long_double u; \ - u.d = (flt); \ - u.ieee_nan.mantissa0 = 0; \ - u.ieee_nan.mantissa1 = 0; \ - u.ieee_nan.mantissa2 = (mant) >> 32; \ - u.ieee_nan.mantissa3 = (mant); \ - if ((u.ieee.mantissa0 | u.ieee.mantissa1 \ - | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \ - (flt) = u.d; \ - } \ - while (0) diff --git a/sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h b/sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h new file mode 100644 index 0000000..6534075 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h @@ -0,0 +1,29 @@ +/* NaN payload handling or ldbl-128ibm. + Copyright (C) 1997-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 + . */ + +#define SET_NAN_PAYLOAD(flt, mant) \ + do \ + { \ + union ibm_extended_long_double u; \ + u.ld = (flt); \ + u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \ + u.d[0].ieee_nan.mantissa1 = (mant); \ + if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \ + (flt) = u.ld; \ + } \ + while (0) diff --git a/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h deleted file mode 100644 index cfa9c1e..0000000 --- a/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For ldbl-128ibm. - Copyright (C) 1997-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 - . */ - -#define FLOAT long double -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ibm_extended_long_double u; \ - u.ld = (flt); \ - u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \ - u.d[0].ieee_nan.mantissa1 = (mant); \ - if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \ - (flt) = u.ld; \ - } \ - while (0) diff --git a/sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h b/sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h new file mode 100644 index 0000000..ab2542c --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h @@ -0,0 +1,29 @@ +/* NaN payload handling for ldbl-96. + Copyright (C) 1997-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 + . */ + +#define SET_NAN_PAYLOAD(flt, mant) \ + do \ + { \ + union ieee854_long_double u; \ + u.d = (flt); \ + u.ieee_nan.mantissa0 = (mant) >> 32; \ + u.ieee_nan.mantissa1 = (mant); \ + if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \ + (flt) = u.d; \ + } \ + while (0) diff --git a/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h deleted file mode 100644 index 08104b7..0000000 --- a/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For ldbl-96. - Copyright (C) 1997-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 - . */ - -#define FLOAT long double -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ieee854_long_double u; \ - u.d = (flt); \ - u.ieee_nan.mantissa0 = (mant) >> 32; \ - u.ieee_nan.mantissa1 = (mant); \ - if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \ - (flt) = u.d; \ - } \ - while (0) diff --git a/wcsmbs/wcstod_nan.c b/wcsmbs/wcstod_nan.c index 1aee82d..1423f3e 100644 --- a/wcsmbs/wcstod_nan.c +++ b/wcsmbs/wcstod_nan.c @@ -17,7 +17,7 @@ . */ #include "../stdlib/strtod_nan_wide.h" -#include "../stdlib/strtod_nan_double.h" +#include #define STRTOD_NAN __wcstod_nan #include "../stdlib/strtod_nan_main.c" diff --git a/wcsmbs/wcstof_nan.c b/wcsmbs/wcstof_nan.c index 9c89e24..96f2198 100644 --- a/wcsmbs/wcstof_nan.c +++ b/wcsmbs/wcstof_nan.c @@ -17,7 +17,7 @@ . */ #include "../stdlib/strtod_nan_wide.h" -#include "../stdlib/strtod_nan_float.h" +#include #define STRTOD_NAN __wcstof_nan #include "../stdlib/strtod_nan_main.c" diff --git a/wcsmbs/wcstold_nan.c b/wcsmbs/wcstold_nan.c index a4d274f..66793ec 100644 --- a/wcsmbs/wcstold_nan.c +++ b/wcsmbs/wcstold_nan.c @@ -23,7 +23,7 @@ representation. */ #ifndef __NO_LONG_DOUBLE_MATH # include "../stdlib/strtod_nan_wide.h" -# include +# include # define STRTOD_NAN __wcstold_nan # include "../stdlib/strtod_nan_main.c" -- cgit v1.1