From patchwork Fri Jun 14 12:33:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 17926 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f197.google.com (mail-gh0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0C3EA25E08 for ; Fri, 14 Jun 2013 12:33:56 +0000 (UTC) Received: by mail-gh0-f197.google.com with SMTP id r20sf481953ghr.0 for ; Fri, 14 Jun 2013 05:33:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:message-id :date:from:user-agent:mime-version:to:cc:subject:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=bscEW2SSkIZ7Rv/xz2ALAcbUZsVEvmeQn4I+vBcODME=; b=DvqW6Ji/bLXA9RWC8ciBjDzHTIEf4iWxQ+AidA/MG2ANpe8VKUPrv522TVcNmkam68 lQL/xEJp+imsyYXciLCYeUNsFU2mbTTQcWmPS0Qyqdq0rJjnUfTnZ4cBjEL1y3H6Y/Qe r2ZzlPxqDfTQuV/eQz1zyW5UWn0EmdPujZB9s6+jEBXyD1IUwfDxWBQ8C2WeKB2u8wcK NQvv3h4vubzUZ/XtmB1IMDXrIUqYHjuvjcZHmxMqMHrx1VHsrJPsQOP4tFGdMcUjuvhw X1F+VZfpBWCAc5iSQ8M/4Zty+EmapG+4OuecMPbF6MUe1jJ3FF+pq8SRlLJk/mJP7sSG si2A== X-Received: by 10.224.174.145 with SMTP id t17mr1063250qaz.4.1371213235537; Fri, 14 Jun 2013 05:33:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.71 with SMTP id w7ls175750qej.69.gmail; Fri, 14 Jun 2013 05:33:55 -0700 (PDT) X-Received: by 10.58.248.39 with SMTP id yj7mr836454vec.53.1371213235350; Fri, 14 Jun 2013 05:33:55 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id tq4si846352vdc.92.2013.06.14.05.33.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Jun 2013 05:33:55 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id m1so413270ves.14 for ; Fri, 14 Jun 2013 05:33:55 -0700 (PDT) X-Received: by 10.220.215.73 with SMTP id hd9mr863997vcb.19.1371213235001; Fri, 14 Jun 2013 05:33:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp61033vec; Fri, 14 Jun 2013 05:33:54 -0700 (PDT) X-Received: by 10.14.206.193 with SMTP id l41mr2790216eeo.154.1371213233431; Fri, 14 Jun 2013 05:33:53 -0700 (PDT) Received: from mail-ee0-x229.google.com (mail-ee0-x229.google.com [2a00:1450:4013:c00::229]) by mx.google.com with ESMTPS id z8si1678442eee.299.2013.06.14.05.33.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Jun 2013 05:33:53 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4013:c00::229 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=2a00:1450:4013:c00::229; Received: by mail-ee0-f41.google.com with SMTP id d17so325804eek.0 for ; Fri, 14 Jun 2013 05:33:53 -0700 (PDT) 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 13:33:50 +0100 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. X-Gm-Message-State: ALoCoQlMCGyxR08o+2Cx7ivdtfGF1h2gW0JS3l0QGyIjEkvwJ+Xl9QDfC7ZtLJLYPVO/IGINvSzP X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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