From owner-svn-src-head@FreeBSD.ORG Tue Feb 3 14:17:30 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF14BDC8; Tue, 3 Feb 2015 14:17:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB5383A6; Tue, 3 Feb 2015 14:17:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t13EHUTa074688; Tue, 3 Feb 2015 14:17:30 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t13EHU9g074687; Tue, 3 Feb 2015 14:17:30 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201502031417.t13EHU9g074687@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 3 Feb 2015 14:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278154 - head/lib/msun/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2015 14:17:31 -0000 Author: pfg Date: Tue Feb 3 14:17:29 2015 New Revision: 278154 URL: https://svnweb.freebsd.org/changeset/base/278154 Log: Reduce confusion in scalbnl() family of functions. The changes unrelated to the bug in r277948 made the code very difficult to understand to both coverity and regular humans so take a step back to something that is much easier to understand for both and follows better the original code. CID: 1267992, 1267993, 1267994 Discussed with: kargl Modified: head/lib/msun/src/s_scalbln.c Modified: head/lib/msun/src/s_scalbln.c ============================================================================== --- head/lib/msun/src/s_scalbln.c Tue Feb 3 13:45:06 2015 (r278153) +++ head/lib/msun/src/s_scalbln.c Tue Feb 3 14:17:29 2015 (r278154) @@ -35,7 +35,9 @@ scalbln (double x, long n) { int in; - in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n; + in = (int)n; + if (in != n) + in = (n > 0) ? INT_MAX: INT_MIN; return (scalbn(x, in)); } @@ -44,7 +46,9 @@ scalblnf (float x, long n) { int in; - in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n; + in = (int)n; + if (in != n) + in = (n > 0) ? INT_MAX: INT_MIN; return (scalbnf(x, in)); } @@ -53,6 +57,9 @@ scalblnl (long double x, long n) { int in; - in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n; + in = (int)n; + if (in != n) { + in = (n > 0) ? INT_MAX: INT_MIN; + } return (scalbnl(x, in)); }