From owner-svn-src-head@FreeBSD.ORG Sat Feb 7 00:38:20 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 142F13E4; Sat, 7 Feb 2015 00:38:20 +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 002D4813; Sat, 7 Feb 2015 00:38:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t170cJtN036164; Sat, 7 Feb 2015 00:38:19 GMT (envelope-from kargl@FreeBSD.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t170cJ8q036163; Sat, 7 Feb 2015 00:38:19 GMT (envelope-from kargl@FreeBSD.org) Message-Id: <201502070038.t170cJ8q036163@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kargl set sender to kargl@FreeBSD.org using -f From: Steve Kargl Date: Sat, 7 Feb 2015 00:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278339 - 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: Sat, 07 Feb 2015 00:38:20 -0000 Author: kargl Date: Sat Feb 7 00:38:18 2015 New Revision: 278339 URL: https://svnweb.freebsd.org/changeset/base/278339 Log: Truncate the exponent 'n' of type long to a domain contained within [INT_MIN, INT_MAX] where the magnitude of the lower and upper bounds are sufficiently large to span the range of scalbn[fl]. While here, remove the GNU style bug in the function declarations. Reviewed by: bde, pfg Modified: head/lib/msun/src/s_scalbln.c Modified: head/lib/msun/src/s_scalbln.c ============================================================================== --- head/lib/msun/src/s_scalbln.c Sat Feb 7 00:13:36 2015 (r278338) +++ head/lib/msun/src/s_scalbln.c Sat Feb 7 00:38:18 2015 (r278339) @@ -27,38 +27,28 @@ #include __FBSDID("$FreeBSD$"); -#include #include +#define NMAX 65536 +#define NMIN -65536 + double -scalbln (double x, long n) +scalbln(double x, long n) { - int in; - in = (int)n; - if (in != n) - in = (n > 0) ? INT_MAX: INT_MIN; - return (scalbn(x, in)); + return (scalbn(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); } float -scalblnf (float x, long n) +scalblnf(float x, long n) { - int in; - in = (int)n; - if (in != n) - in = (n > 0) ? INT_MAX: INT_MIN; - return (scalbnf(x, in)); + return (scalbnf(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); } long double -scalblnl (long double x, long n) +scalblnl(long double x, long n) { - int in; - in = (int)n; - if (in != n) - in = (n > 0) ? INT_MAX: INT_MIN; - return (scalbnl(x, in)); + return (scalbnl(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); }