From owner-svn-src-head@freebsd.org Thu Mar 26 18:51:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F08092A6D54; Thu, 26 Mar 2020 18:51:03 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48pDb83Yj0z4R30; Thu, 26 Mar 2020 18:51:00 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46880B061; Thu, 26 Mar 2020 18:50:55 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02QIotkC057577; Thu, 26 Mar 2020 18:50:55 GMT (envelope-from alfredo@FreeBSD.org) Received: (from alfredo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02QIotTP057576; Thu, 26 Mar 2020 18:50:55 GMT (envelope-from alfredo@FreeBSD.org) Message-Id: <202003261850.02QIotTP057576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alfredo set sender to alfredo@FreeBSD.org using -f From: "Alfredo Dal'Ava Junior" Date: Thu, 26 Mar 2020 18:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359342 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: alfredo X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 359342 X-SVN-Commit-Repository: base 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.29 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: Thu, 26 Mar 2020 18:51:04 -0000 Author: alfredo Date: Thu Mar 26 18:50:54 2020 New Revision: 359342 URL: https://svnweb.freebsd.org/changeset/base/359342 Log: msun: swap words order instead of bits order on BIG ENDIAN The "for" loop on big endian was inverting all the bits instead of just the words Issue reported by TestSuite (msun lib nan_test case) Submitted by: Renato Riolino Submitted by: Fernando Valle Reviewed by: pfg, alfredo Approved by: jhibbits (mentor) Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23926 Modified: head/lib/msun/src/s_nan.c Modified: head/lib/msun/src/s_nan.c ============================================================================== --- head/lib/msun/src/s_nan.c Thu Mar 26 17:59:48 2020 (r359341) +++ head/lib/msun/src/s_nan.c Thu Mar 26 18:50:54 2020 (r359342) @@ -66,14 +66,15 @@ _scan_nan(uint32_t *words, int num_words, const char * ; /* Scan backwards, filling in the bits in words[] as we go. */ -#if _BYTE_ORDER == _LITTLE_ENDIAN for (bitpos = 0; bitpos < 32 * num_words; bitpos += 4) { -#else - for (bitpos = 32 * num_words - 4; bitpos >= 0; bitpos -= 4) { -#endif if (--si < 0) break; +#if _BYTE_ORDER == _LITTLE_ENDIAN words[bitpos / 32] |= digittoint(s[si]) << (bitpos % 32); +#else + words[num_words - 1 - bitpos / 32] |= + digittoint(s[si]) << (bitpos % 32); +#endif } }