about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-12-28 14:28:07 +0000
committerUlrich Drepper <drepper@redhat.com>1998-12-28 14:28:07 +0000
commit76235ed48f5bc3ec639e886633fc45bede1c470b (patch)
treefea71a7be41602645e2139d0552bb2378a2069fe
parentdb276fa11c8a8b574f3467680a3372504629c114 (diff)
downloadglibc-76235ed48f5bc3ec639e886633fc45bede1c470b.tar.gz
glibc-76235ed48f5bc3ec639e886633fc45bede1c470b.tar.xz
glibc-76235ed48f5bc3ec639e886633fc45bede1c470b.zip
Update.
1998-12-28  Ulrich Drepper  <drepper@cygnus.com>

	* stdlib/fpioconst.c: If __NO_LONG_DOUBLE_MATH don't define constants
	beyond range of double.
	* stdlib/fpioconst.h (_fpioconst_pow10): Reduce size according to
	fpioconst.c change.
	* stdlib/strtold.c: Fall back on double functions if
	__NO_LONG_DOUBLE_MATH.
	* stdlib/strtold_l.c: Likewise.
	* wcsmbs/wcstold.c: Likewise.
	* wcsmbs/wcstold_l.c: Likewise.
	* sysdeps/ieee754/ldbl2mpn.c: Don't generate code if
	__NO_LONG_DOUBLE_MATH.
	* sysdeps/ieee754/mpn2ldbl.c: Likewise.

1998-12-28  Geoff Keating  <geoffk@ozemail.com.au>

	* sysdeps/powerpc/bits/endian.h: Use #warning, not #error, if
	the endianness can't be determined, for makedepend.
-rw-r--r--ChangeLog20
-rw-r--r--stdlib/fpioconst.c24
-rw-r--r--stdlib/fpioconst.h7
-rw-r--r--stdlib/strtold.c39
-rw-r--r--stdlib/strtold_l.c23
-rw-r--r--sysdeps/ieee754/ldbl2mpn.c7
-rw-r--r--sysdeps/ieee754/mpn2ldbl.c7
-rw-r--r--sysdeps/powerpc/bits/endian.h3
-rw-r--r--wcsmbs/wcstold.c42
-rw-r--r--wcsmbs/wcstold_l.c22
10 files changed, 153 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 51109f1d58..3d8ca03731 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+1998-12-28  Ulrich Drepper  <drepper@cygnus.com>
+
+	* stdlib/fpioconst.c: If __NO_LONG_DOUBLE_MATH don't define constants
+	beyond range of double.
+	* stdlib/fpioconst.h (_fpioconst_pow10): Reduce size according to
+	fpioconst.c change.
+	* stdlib/strtold.c: Fall back on double functions if
+	__NO_LONG_DOUBLE_MATH.
+	* stdlib/strtold_l.c: Likewise.
+	* wcsmbs/wcstold.c: Likewise.
+	* wcsmbs/wcstold_l.c: Likewise.
+	* sysdeps/ieee754/ldbl2mpn.c: Don't generate code if
+	__NO_LONG_DOUBLE_MATH.
+	* sysdeps/ieee754/mpn2ldbl.c: Likewise.
+
+1998-12-28  Geoff Keating  <geoffk@ozemail.com.au>
+
+	* sysdeps/powerpc/bits/endian.h: Use #warning, not #error, if
+	the endianness can't be determined, for makedepend.
+
 1998-12-27  Ulrich Drepper  <drepper@cygnus.com>
 
 	* elf/dl-lookup.c (_dl_num_relocations): New variable.
diff --git a/stdlib/fpioconst.c b/stdlib/fpioconst.c
index d8c5fda956..925d21cb28 100644
--- a/stdlib/fpioconst.c
+++ b/stdlib/fpioconst.c
@@ -1,5 +1,5 @@
 /* Table of MP integer constants 10^(2^i), used for floating point <-> decimal.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998 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
@@ -54,6 +54,7 @@ static const mp_limb_t _ten_p8[] =
     0xd8d99f72, 0x12152f87, 0x6bde50c6, 0xcf4a6e70, 0xd595d80f, 0x26b2716e,
     0xadc666b0, 0x1d153624, 0x3c42d35a, 0x63ff540e, 0xcc5573c0, 0x65f9ef17,
     0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x000553f7 };
+#ifndef __NO_LONG_DOUBLE_MATH
 static const mp_limb_t _ten_p9[] =
   { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -195,9 +196,7 @@ static const mp_limb_t _ten_p12[] =
     0xd868b275, 0x8bd2b496, 0x1c5563f4, 0xc234d8f5, 0xf868e970, 0xf9151fff,
     0xae7be4a2, 0x271133ee, 0xbb0fd922, 0x25254932, 0xa60a9fc0, 0x104bcd64,
     0x30290145, 0x00000062 };
-
-/* This value is the index of the last array element.  */
-#define _LAST_POW10	12
+#endif	/* !__NO_LONG_DOUBLE_MATH */
 
 #elif BITS_PER_MP_LIMB == 64
 
@@ -228,6 +227,7 @@ static const mp_limb_t _ten_p8[] =
     0x12152f87d8d99f72, 0xcf4a6e706bde50c6, 0x26b2716ed595d80f,
     0x1d153624adc666b0, 0x63ff540e3c42d35a, 0x65f9ef17cc5573c0,
     0x80dcc7f755bc28f2, 0x5fdcefcef46eeddc, 0x00000000000553f7 };
+#ifndef __NO_LONG_DOUBLE_MATH
 static const mp_limb_t _ten_p9[] =
   { 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
     0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -369,14 +369,18 @@ static const mp_limb_t _ten_p12[] =
     0x8bd2b496d868b275, 0xc234d8f51c5563f4, 0xf9151ffff868e970,
     0x271133eeae7be4a2, 0x25254932bb0fd922, 0x104bcd64a60a9fc0,
     0x0000006230290145 };
-
-/* This value is the index of the last array element.  */
-#define _LAST_POW10	12
+#endif
 
 #else
-#  error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
+# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
 #endif
 
+#ifndef __NO_LONG_DOUBLE_MATH
+/* This value is the index of the last array element.  */
+# define _LAST_POW10	12
+#else
+# define _LAST_POW10	8
+#endif
 
 /* Each of array variable above defines one mpn integer which is a power of 10.
    This table points to those variables, indexed by the exponent.  */
@@ -392,12 +396,14 @@ const struct mp_power _fpioconst_pow10[_LAST_POW10 + 1] =
     { _ten_p6, sizeof (_ten_p6) / sizeof (_ten_p6[0]),		213,	 210 },
     { _ten_p7, sizeof (_ten_p7) / sizeof (_ten_p7[0]),		426,	 422 },
     { _ten_p8, sizeof (_ten_p8) / sizeof (_ten_p8[0]),	  	851,	 848 },
+#ifndef __NO_LONG_DOUBLE_MATH
     { _ten_p9, sizeof (_ten_p9) / sizeof (_ten_p9[0]),	 	1701,	1698 },
     { _ten_p10, sizeof (_ten_p10) / sizeof (_ten_p10[0]),	3402,	3399 },
     { _ten_p11, sizeof (_ten_p11) / sizeof (_ten_p11[0]),	6804,	6800 },
     { _ten_p12, sizeof (_ten_p12) / sizeof (_ten_p12[0]), 	13607, 13604 }
+#endif
   };
 
 #if LAST_POW10 > _LAST_POW10
-#error "Need to expand 10^(2^i) table for i up to" LAST_POW10
+# error "Need to expand 10^(2^i) table for i up to" LAST_POW10
 #endif
diff --git a/stdlib/fpioconst.h b/stdlib/fpioconst.h
index 35c7c6f02b..88dd0365fe 100644
--- a/stdlib/fpioconst.h
+++ b/stdlib/fpioconst.h
@@ -1,5 +1,5 @@
 /* Header file for constants used in floating point <-> decimal conversions.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998 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
@@ -21,6 +21,7 @@
 #define	_FPIOCONST_H
 
 #include <float.h>
+#include <math.h>
 #include "gmp.h"
 
 
@@ -46,7 +47,11 @@ struct mp_power
     int p_expo;			/* Exponent of the number 10^(2^i).  */
     int m_expo;			/* Exponent of the number 10^-(2^i-1).  */
   };
+#ifndef __NO_LONG_DOUBLE_MATH
 extern const struct mp_power _fpioconst_pow10[LDBL_MAX_10_EXP_LOG + 1];
+#else
+extern const struct mp_power _fpioconst_pow10[DBL_MAX_10_EXP_LOG + 1];
+#endif
 
 /* The constants in the array `_fpioconst_pow10' have an offset.  */
 #if BITS_PER_MP_LIMB == 32
diff --git a/stdlib/strtold.c b/stdlib/strtold.c
index 32e7e90943..c808efc744 100644
--- a/stdlib/strtold.c
+++ b/stdlib/strtold.c
@@ -1,16 +1,19 @@
+#include <math.h>
+
+#ifndef __NO_LONG_DOUBLE_MATH
 /* The actual implementation for all floating point sizes is in strtod.c.
    These macros tell it to produce the `long double' version, `strtold'.  */
 
-#define	FLOAT		long double
-#define	FLT		LDBL
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define STRTOF		__strtold_l
-#else
-# define STRTOF		strtold
-#endif
-#define	MPN2FLOAT	__mpn_construct_long_double
-#define	FLOAT_HUGE_VAL	HUGE_VALL
-#define SET_MANTISSA(flt, mant) \
+# define FLOAT		long double
+# define FLT		LDBL
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define STRTOF	__strtold_l
+# else
+#  define STRTOF	strtold
+# endif
+# define MPN2FLOAT	__mpn_construct_long_double
+# define FLOAT_HUGE_VAL	HUGE_VALL
+# define SET_MANTISSA(flt, mant) \
   do { union ieee854_long_double u;					      \
        u.d = (flt);							      \
        if ((mant & 0x7fffffffffffffffULL) == 0)				      \
@@ -20,4 +23,18 @@
        (flt) = u.d;							      \
   } while (0)
 
-#include "strtod.c"
+# include "strtod.c"
+#else
+/* There is no `long double' type, use the `double' implementations.  */
+long double
+__strtold_internal (const char *nptr, char **endptr, int group)
+{
+  return __strtod_internal (nptr, endptr, group);
+}
+
+long double
+strtold (const char *nptr, char **endptr)
+{
+  return __strtod_internal (nptr, endptr, 0);
+}
+#endif
diff --git a/stdlib/strtold_l.c b/stdlib/strtold_l.c
index 2a1f1f5054..3a48c628ce 100644
--- a/stdlib/strtold_l.c
+++ b/stdlib/strtold_l.c
@@ -18,13 +18,32 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define USE_IN_EXTENDED_LOCALE_MODEL	1
+#include <math.h>
+
+#ifndef __NO_LONG_DOUBLE_MATH
 
 #include <xlocale.h>
+#define USE_IN_EXTENDED_LOCALE_MODEL	1
 
 extern long double ____strtold_l_internal (const char *, char **, int,
 					   __locale_t);
 extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 						       int, int, __locale_t);
 
-#include <strtold.c>
+# include <strtold.c>
+
+#else
+/* There is no `long double' type, use the `double' implementations.  */
+long double
+____strtold_l_internal (const char *nptr, char **endptr, int group,
+			__locale_t loc)
+{
+  return ____strtod_l_internal (nptr, endptr, group, loc);
+}
+
+long double
+__strtold_l (const char *nptr, char **endptr, __locale_t loc)
+{
+  return __strtod_internal (nptr, endptr, 0, loc);
+}
+#endif
diff --git a/sysdeps/ieee754/ldbl2mpn.c b/sysdeps/ieee754/ldbl2mpn.c
index dfec095912..e95895c0af 100644
--- a/sysdeps/ieee754/ldbl2mpn.c
+++ b/sysdeps/ieee754/ldbl2mpn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 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
@@ -21,8 +21,11 @@
 #include "longlong.h"
 #include <ieee754.h>
 #include <float.h>
+#include <math.h>
 #include <stdlib.h>
 
+#ifndef __NO_LONG_DOUBLE_MATH
+
 /* Convert a `long double' in IEEE854 standard double-precision format to a
    multi-precision integer representing the significand scaled up by its
    number of bits (64 for long double) and an integral power of two
@@ -92,3 +95,5 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
 
   return N;
 }
+
+#endif	/* __NO_LONG_DOUBLE_MATH */
diff --git a/sysdeps/ieee754/mpn2ldbl.c b/sysdeps/ieee754/mpn2ldbl.c
index 2f410c99d7..7802355eba 100644
--- a/sysdeps/ieee754/mpn2ldbl.c
+++ b/sysdeps/ieee754/mpn2ldbl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 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
@@ -20,6 +20,9 @@
 #include "gmp-impl.h"
 #include <ieee754.h>
 #include <float.h>
+#include <math.h>
+
+#ifndef __NO_LONG_DOUBLE_MATH
 
 /* Convert a multi-precision integer of the needed number of bits (64 for
    long double) and an integral power of two to a `long double' in IEEE854
@@ -44,3 +47,5 @@ __mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
 
   return u.d;
 }
+
+#endif /* __NO_LONG_DOUBLE_MATH */
diff --git a/sysdeps/powerpc/bits/endian.h b/sysdeps/powerpc/bits/endian.h
index d292ba9fdb..fdfadf9c1b 100644
--- a/sysdeps/powerpc/bits/endian.h
+++ b/sysdeps/powerpc/bits/endian.h
@@ -31,6 +31,7 @@
 # if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
 #  define __BYTE_ORDER __LITTLE_ENDIAN
 # else
-#  error Cannot determine current byte order.
+#  warning Cannot determine current byte order, assuming big-endian.
+#  define __BYTE_ORDER __BIG_ENDIAN
 # endif
 #endif
diff --git a/wcsmbs/wcstold.c b/wcsmbs/wcstold.c
index fc8c010bec..89e8de8eb9 100644
--- a/wcsmbs/wcstold.c
+++ b/wcsmbs/wcstold.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -17,21 +17,23 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <math.h>
 
+#ifndef __NO_LONG_DOUBLE_MATH
 /* The actual implementation for all floating point sizes is in strtod.c.
    These macros tell it to produce the `long double' version, `wcstold'.  */
 
-#define	FLOAT		long double
-#define	FLT		LDBL
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define STRTOF		__wcstold_l
-#else
-# define STRTOF		wcstold
-#endif
-#define	MPN2FLOAT	__mpn_construct_long_double
-#define	FLOAT_HUGE_VAL	HUGE_VALL
-#define	USE_WIDE_CHAR	1
-#define SET_MANTISSA(flt, mant) \
+# define FLOAT		long double
+# define FLT		LDBL
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define STRTOF	__wcstold_l
+# else
+#  define STRTOF	wcstold
+# endif
+# define MPN2FLOAT	__mpn_construct_long_double
+# define FLOAT_HUGE_VAL	HUGE_VALL
+# define USE_WIDE_CHAR	1
+# define SET_MANTISSA(flt, mant) \
   do { union ieee854_long_double u;					      \
        u.d = (flt);							      \
        if ((mant & 0x7fffffffffffffffULL) == 0)				      \
@@ -41,4 +43,18 @@
        (flt) = u.d;							      \
   } while (0)
 
-#include <stdlib/strtod.c>
+# include <stdlib/strtod.c>
+#else
+/* There is no `long double' type, use the `double' implementations.  */
+long double
+__wcstold_internal (const wchar_t *nptr, wchar_t **endptr, int group)
+{
+  return __wcstod_internal (nptr, endptr, group);
+}
+
+long double
+wcstold (const wchar_t *nptr, wchar_t **endptr)
+{
+  return __wcstod_internal (nptr, endptr, 0);
+}
+#endif
diff --git a/wcsmbs/wcstold_l.c b/wcsmbs/wcstold_l.c
index f92ec78026..8f6272561c 100644
--- a/wcsmbs/wcstold_l.c
+++ b/wcsmbs/wcstold_l.c
@@ -19,10 +19,13 @@
    Boston, MA 02111-1307, USA.  */
 
 #define __need_wchar_t
+#include <math.h>
 #include <stddef.h>
 #include <locale.h>
 
-#define USE_IN_EXTENDED_LOCALE_MODEL	1
+#ifndef __NO_LONG_DOUBLE_MATH
+
+# define USE_IN_EXTENDED_LOCALE_MODEL	1
 
 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
 					   __locale_t);
@@ -30,4 +33,19 @@ extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 						       wchar_t **, int, int,
 						       __locale_t);
 
-#include <wcstold.c>
+# include <wcstold.c>
+#else
+/* There is no `long double' type, use the `double' implementations.  */
+long double
+____wcstold_l_internal (const wchar_t *nptr, wchar_t **endptr, int group,
+			__locale_t loc)
+{
+  return ____wcstod_l_internal (nptr, endptr, group, loc);
+}
+
+long double
+__wcstold_l (const wchar_t *nptr, wchar_t **endptr, __locale_t loc)
+{
+  return __wcstod_internal (nptr, endptr, 0, loc);
+}
+#endif