From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uChVM8MXUWNqsQ4AWB0awg (envelope-from ) for ; Thu, 20 Oct 2022 05:41:23 -0400 Received: by simark.ca (Postfix, from userid 112) id CE6421E112; Thu, 20 Oct 2022 05:41:23 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=faZbayNa; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 873B41E0D5 for ; Thu, 20 Oct 2022 05:41:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52D35396D82A for ; Thu, 20 Oct 2022 09:41:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52D35396D82A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666258860; bh=hI/p5isefST8vEytaz1gnVwBofv54NaUpMAfvNunBJk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=faZbayNattOiFfyo8e/y0cac27SXShf7uetePWFQksoEsJzUn9ZUw7XAYepHiFFdC n7fasuFNK/tXAfQAS6gtR36HaIKSD8pVUDFPv8wIV3D2AB86WyeHqk86ke8do3Tcj+ xWI0ITHSKPVaSW9KMGTzSd6QzLeC6/H53e75lGSI= Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 3ACFE3853807 for ; Thu, 20 Oct 2022 09:39:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3ACFE3853807 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 938CD300089; Thu, 20 Oct 2022 09:39:12 +0000 (UTC) To: Tsukasa OI , Andrew Burgess , Mike Frysinger , Nick Clifton Subject: [PATCH 36/40] sim/sh: Use fabs instead of abs Date: Thu, 20 Oct 2022 09:32:41 +0000 Message-Id: <1c1dc37d64784ff8fec4ab3e322f6b84693d8b92.1666258361.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tsukasa OI via Gdb-patches Reply-To: Tsukasa OI Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Clang generates a warning if abs function is called with a floating point argument ("-Wabsolute-value"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). After careful investigation, it is concluded that replacing abs with fabs is completely safe. --- sim/sh/interp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/sh/interp.c b/sim/sh/interp.c index fb92d9f4480..38f3f945a35 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -1401,7 +1401,7 @@ fsca_s (int in, double (*f) (double)) lower = result - error; frac = frexp (lower, &exp); lower = ldexp (ceil (ldexp (frac, 24)), exp - 24); - return abs (upper - result) >= abs (lower - result) ? upper : lower; + return fabs (upper - result) >= fabs (lower - result) ? upper : lower; } static float -- 2.34.1