From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28946 invoked by alias); 14 Jun 2013 12:34:08 -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 28933 invoked by uid 89); 14 Jun 2013 12:34:07 -0000 X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Received: from mail-ea0-f171.google.com (HELO mail-ea0-f171.google.com) (209.85.215.171) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 14 Jun 2013 12:33:55 +0000 Received: by mail-ea0-f171.google.com with SMTP id m14so322363eaj.16 for ; Fri, 14 Jun 2013 05:33:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=bscEW2SSkIZ7Rv/xz2ALAcbUZsVEvmeQn4I+vBcODME=; b=YI1OBIs/QC1XkjItcChhmM1rvXRsAEJt6c0C09yAOTMv9mYopHEkjEF+Sr145xKAmG vEWL5oGCWOe3rrmoao5+US8flCttfJzboT83JdPbz9IxWS+N68u3QKgt5SBPkZKGL7bg CJDPgt2/KHSaYrLEc1yivGMXtlCDsb3giecHUP30b2mrRzInF/3uOHbYALdGtRo7cag7 01jdU+9IwGnm8OC9hCTLJQEI3xUR+gixVyDC+xCCA07TaDMVrLCwV4XQwXJGRGGhLxD5 kN7I32Gt3B4Hgzn6/s8UrXm1DMkC9xnKzEtrM6uJxd9XceVwwZQkOTxrRDEwq4F5+VGc RDeA== X-Received: by 10.14.220.66 with SMTP id n42mr2814973eep.67.1371213232890; Fri, 14 Jun 2013 05:33:52 -0700 (PDT) Received: from localhost.localdomain (cpc11-seac20-2-0-cust84.7-2.cable.virginmedia.com. [81.108.156.85]) by mx.google.com with ESMTPSA id bk1sm3364020eeb.5.2013.06.14.05.33.51 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 14 Jun 2013 05:33:52 -0700 (PDT) Message-ID: <51BB0DAE.2070504@linaro.org> Date: Fri, 14 Jun 2013 12:34:00 -0000 From: Will Newton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: patches@linaro.org Subject: [PATCH 2/2] gdb/doublest.c: Use frexpl rather than ldfrexp. Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnDeoSUQs+ZqO2ToICCkpmcAqO0fE+NKBIOYRfi5GDqMcDjRf9aaqYRqtelho7ZnWJT4k6n X-SW-Source: 2013-06/txt/msg00330.txt.bz2 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. 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