From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4287 invoked by alias); 14 Jun 2013 12:53:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4258 invoked by uid 89); 14 Jun 2013 12:53:06 -0000 X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 14 Jun 2013 12:53:05 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id r5ECr0Bl027819; Fri, 14 Jun 2013 14:53:00 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id r5ECqxUX021717; Fri, 14 Jun 2013 14:52:59 +0200 (CEST) Date: Fri, 14 Jun 2013 13:03:00 -0000 Message-Id: <201306141252.r5ECqxUX021717@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: will.newton@linaro.org CC: gdb-patches@sourceware.org, patches@linaro.org In-reply-to: <51BB0DAE.2070504@linaro.org> (message from Will Newton on Fri, 14 Jun 2013 13:33:50 +0100) Subject: Re: [PATCH 2/2] gdb/doublest.c: Use frexpl rather than ldfrexp. References: <51BB0DAE.2070504@linaro.org> X-SW-Source: 2013-06/txt/msg00333.txt.bz2 > Date: Fri, 14 Jun 2013 13:33:50 +0100 > From: Will Newton > > Most modern systems have frexpl and gnulib provides an implementation > for those that don't, so use it instead of the generic but inaccurate > ldfrexp. Great! Hopefully somebody with more gnulib experience can approve the other diff. > gdb/ChangeLog: > > 2013-06-14 Will Newton > > * doublest.c (ldfrexp): Remove function. > (convert_doublest_to_floatformat): Call frexpl instead of > ldfrexp. > --- > gdb/doublest.c | 49 +------------------------------------------------ > 1 file changed, 1 insertion(+), 48 deletions(-) > > diff --git a/gdb/doublest.c b/gdb/doublest.c > index 9ddc7a6..2e4c87e 100644 > --- a/gdb/doublest.c > +++ b/gdb/doublest.c > @@ -336,53 +336,6 @@ put_field (unsigned char *data, enum floatformat_byteorders order, > } > } > > -#ifdef HAVE_LONG_DOUBLE > -/* Return the fractional part of VALUE, and put the exponent of VALUE in *EPTR. > - The range of the returned value is >= 0.5 and < 1.0. This is equivalent to > - frexp, but operates on the long double data type. */ > - > -static long double ldfrexp (long double value, int *eptr); > - > -static long double > -ldfrexp (long double value, int *eptr) > -{ > - long double tmp; > - int exp; > - > - /* Unfortunately, there are no portable functions for extracting the > - exponent of a long double, so we have to do it iteratively by > - multiplying or dividing by two until the fraction is between 0.5 > - and 1.0. */ > - > - if (value < 0.0l) > - value = -value; > - > - tmp = 1.0l; > - exp = 0; > - > - if (value >= tmp) /* Value >= 1.0 */ > - while (value >= tmp) > - { > - tmp *= 2.0l; > - exp++; > - } > - else if (value != 0.0l) /* Value < 1.0 and > 0.0 */ > - { > - while (value < tmp) > - { > - tmp /= 2.0l; > - exp--; > - } > - tmp *= 2.0l; > - exp++; > - } > - > - *eptr = exp; > - return value / tmp; > -} > -#endif /* HAVE_LONG_DOUBLE */ > - > - > /* The converse: convert the DOUBLEST *FROM to an extended float and > store where TO points. Neither FROM nor TO have any alignment > restrictions. */ > @@ -466,7 +419,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt, > } > > #ifdef HAVE_LONG_DOUBLE > - mant = ldfrexp (dfrom, &exponent); > + mant = frexpl (dfrom, &exponent); > #else > mant = frexp (dfrom, &exponent); > #endif > -- > 1.8.1.4 > >