summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2005-08-17 18:03:42 +0000
committerDJ Delorie <dj@delorie.com>2005-08-17 18:03:42 +0000
commit482e9ada9bfee1e2fa0a2e05ec4a290a24362023 (patch)
tree4cd7fb6f30fc787b21435ecbf30a0861bd97e764 /libiberty
parent55efeb6a5a27cc70a7dacc7212f6cfd4cdbe8b32 (diff)
downloadbinutils-redhat-482e9ada9bfee1e2fa0a2e05ec4a290a24362023.tar.gz
merge from gcc
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog13
-rw-r--r--libiberty/floatformat.c34
2 files changed, 30 insertions, 17 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index ec9f7797dc..3e2e92e606 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,16 @@
+2005-08-17 Mark Kettenis <kettenis@gnu.org>
+
+ * floatformat.c (floatformat_always_valid): Change type of last
+ argument to `void *'.
+ (floatformat_i387_ext_is_valid): Likewise.
+ (floatformat_to_double): Change type of second argument to `const
+ void *'.
+ (floatformat_from_double): Change type of last argument to `void
+ *'.
+ (floatformat_is_valid): Change type of last argument to `const
+ void *'.
+ (ieee_test): Remove redundant casts.
+
2005-08-17 Kelley Cook <kcook@gcc.gnu.org>
* strverscmp.c: Update FSF address.
diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
index e466f53a7a..8f0d789464 100644
--- a/libiberty/floatformat.c
+++ b/libiberty/floatformat.c
@@ -1,5 +1,6 @@
/* IEEE floating point support routines, for GDB, the GNU Debugger.
- Copyright (C) 1991, 1994, 1999, 2000, 2003 Free Software Foundation, Inc.
+ Copyright 1991, 1994, 1999, 2000, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -52,11 +53,11 @@ static unsigned long get_field (const unsigned char *,
unsigned int,
unsigned int);
static int floatformat_always_valid (const struct floatformat *fmt,
- const char *from);
+ const void *from);
static int
floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
- const char *from ATTRIBUTE_UNUSED)
+ const void *from ATTRIBUTE_UNUSED)
{
return 1;
}
@@ -107,23 +108,24 @@ const struct floatformat floatformat_ieee_double_littlebyte_bigword =
floatformat_always_valid
};
-static int floatformat_i387_ext_is_valid (const struct floatformat *fmt, const char *from);
+static int floatformat_i387_ext_is_valid (const struct floatformat *fmt,
+ const void *from);
static int
-floatformat_i387_ext_is_valid (const struct floatformat *fmt, const char *from)
+floatformat_i387_ext_is_valid (const struct floatformat *fmt, const void *from)
{
/* In the i387 double-extended format, if the exponent is all ones,
then the integer bit must be set. If the exponent is neither 0
nor ~0, the intbit must also be set. Only if the exponent is
zero can it be zero, and then it must be zero. */
unsigned long exponent, int_bit;
- const unsigned char *ufrom = (const unsigned char *) from;
-
+ const unsigned char *ufrom = from;
+
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->exp_start, fmt->exp_len);
int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->man_start, 1);
-
+
if ((exponent == 0) != (int_bit == 0))
return 0;
else
@@ -267,9 +269,9 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
void
floatformat_to_double (const struct floatformat *fmt,
- const char *from, double *to)
+ const void *from, double *to)
{
- const unsigned char *ufrom = (const unsigned char *)from;
+ const unsigned char *ufrom = from;
double dto;
long exponent;
unsigned long mant;
@@ -438,14 +440,14 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
void
floatformat_from_double (const struct floatformat *fmt,
- const double *from, char *to)
+ const double *from, void *to)
{
double dfrom;
int exponent;
double mant;
unsigned int mant_bits, mant_off;
int mant_bits_left;
- unsigned char *uto = (unsigned char *)to;
+ unsigned char *uto = to;
dfrom = *from;
memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
@@ -533,7 +535,7 @@ floatformat_from_double (const struct floatformat *fmt,
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
int
-floatformat_is_valid (const struct floatformat *fmt, const char *from)
+floatformat_is_valid (const struct floatformat *fmt, const void *from)
{
return fmt->is_valid (fmt, from);
}
@@ -550,15 +552,13 @@ ieee_test (double n)
{
double result;
- floatformat_to_double (&floatformat_ieee_double_little, (char *) &n,
- &result);
+ floatformat_to_double (&floatformat_ieee_double_little, &n, &result);
if ((n != result && (! isnan (n) || ! isnan (result)))
|| (n < 0 && result >= 0)
|| (n >= 0 && result < 0))
printf ("Differ(to): %.20g -> %.20g\n", n, result);
- floatformat_from_double (&floatformat_ieee_double_little, &n,
- (char *) &result);
+ floatformat_from_double (&floatformat_ieee_double_little, &n, &result);
if ((n != result && (! isnan (n) || ! isnan (result)))
|| (n < 0 && result >= 0)
|| (n >= 0 && result < 0))