[PATCH newlib v1 3/4] Split libm/common/frexpl.c into LDBL_EQ_DBL and long double versions

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
This resulted in the contents of libm/common/frexpl.c being split
into libm/common/ldbl/s_frexpl.c and libm/common/ldbl_eq_dbl/s_frexpl.c.
---
 newlib/Makefile.am                            |  2 +-
 newlib/libm/common/Makefile.inc               |  6 +--
 .../libm/common/{frexpl.c => ldbl/s_frexpl.c} |  9 ----
 newlib/libm/common/ldbl_eq_dbl/s_frexpl.c     | 42 +++++++++++++++++++
 4 files changed, 46 insertions(+), 13 deletions(-)
 rename newlib/libm/common/{frexpl.c => ldbl/s_frexpl.c} (94%)
 create mode 100644 newlib/libm/common/ldbl_eq_dbl/s_frexpl.c

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 0108d8576..bd99c7b4f 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -116,7 +116,7 @@ MATHOBJS_IN_LIBC = \
 	libm_a-s_isnand.o libm_a-sf_isnanf.o \
 	libm_a-s_nan.o libm_a-sf_nan.o \
 	libm_a-s_ldexp.o libm_a-sf_ldexp.o \
-	libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \
+	libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-s_frexpl.o \
 	libm_a-s_modf.o \
 	libm_a-sf_modf.o libm_a-s_scalbn.o \
 	libm_a-sf_scalbn.o \
diff --git a/newlib/libm/common/Makefile.inc b/newlib/libm/common/Makefile.inc
index d08b8b21a..9ff1231e9 100644
--- a/newlib/libm/common/Makefile.inc
+++ b/newlib/libm/common/Makefile.inc
@@ -60,7 +60,7 @@
 	%D%/sinf.c %D%/cosf.c %D%/sincosf.c %D%/sincosf_data.c %D%/math_errf.c
 
 %C%_lsrc = \
-	%D%/atanl.c %D%/cosl.c %D%/sinl.c %D%/tanl.c %D%/tanhl.c %D%/frexpl.c %D%/modfl.c %D%/ceill.c %D%/fabsl.c \
+	%D%/atanl.c %D%/cosl.c %D%/sinl.c %D%/tanl.c %D%/tanhl.c %D%/modfl.c %D%/ceill.c %D%/fabsl.c \
 	%D%/floorl.c %D%/log1pl.c %D%/expm1l.c %D%/acosl.c %D%/asinl.c %D%/atan2l.c %D%/coshl.c %D%/sinhl.c \
 	%D%/expl.c %D%/ldexpl.c %D%/logl.c %D%/log10l.c %D%/powl.c %D%/sqrtl.c %D%/fmodl.c %D%/hypotl.c \
 	%D%/copysignl.c %D%/nanl.c %D%/ilogbl.c %D%/asinhl.c %D%/cbrtl.c %D%/nextafterl.c %D%/rintl.c \
@@ -70,9 +70,9 @@
 	%D%/logbl.c %D%/nexttowardf.c %D%/nexttoward.c %D%/nexttowardl.c %D%/log2l.c \
 	%D%/sl_finite.c
 
-%C%_ldbl_eq_dbl_src = %D%/ldbl_eq_dbl/s_truncl.c
+%C%_ldbl_eq_dbl_src = %D%/ldbl_eq_dbl/s_frexpl.c %D%/ldbl_eq_dbl/s_truncl.c
 
-%C%_ldbl_src = %D%/ldbl/s_truncl.c
+%C%_ldbl_src = %D%/ldbl/s_frexpl.c %D%/ldbl/s_truncl.c
 
 libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
 
diff --git a/newlib/libm/common/frexpl.c b/newlib/libm/common/ldbl/s_frexpl.c
similarity index 94%
rename from newlib/libm/common/frexpl.c
rename to newlib/libm/common/ldbl/s_frexpl.c
index 8da2823ca..63835c105 100644
--- a/newlib/libm/common/frexpl.c
+++ b/newlib/libm/common/ldbl/s_frexpl.c
@@ -32,14 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <float.h>
 #include "local.h"
 
-/* On platforms where long double is as wide as double.  */
-#if defined(_LDBL_EQ_DBL)
-long double
-frexpl (long double x, int *eptr)
-{
-  return frexp(x, eptr);
-}
-#else  /* !_DBL_EQ_DBL */
 # if (LDBL_MANT_DIG == 53) /* 64-bit long double */
 static const double scale = 0x1p54;
 
@@ -149,4 +141,3 @@ frexpl (long double x, int *eptr)
   u.u32.exp = LDBL_MAX_EXP - 2; /* -1 */
   return u.x;
 }
-#endif /* !_LDBL_EQ_DBL */
diff --git a/newlib/libm/common/ldbl_eq_dbl/s_frexpl.c b/newlib/libm/common/ldbl_eq_dbl/s_frexpl.c
new file mode 100644
index 000000000..90ae0153f
--- /dev/null
+++ b/newlib/libm/common/ldbl_eq_dbl/s_frexpl.c
@@ -0,0 +1,42 @@
+/*
+(C) Copyright IBM Corp. 2009
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <math.h>
+#include <float.h>
+#include "local.h"
+
+/* On platforms where long double is as wide as double.  */
+#if defined(_LDBL_EQ_DBL)
+long double
+frexpl (long double x, int *eptr)
+{
+  return frexp(x, eptr);
+}
+#endif /* !_LDBL_EQ_DBL */
-- 
2.24.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.