From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 74C5D385626E for ; Thu, 23 Jun 2022 11:34:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74C5D385626E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-FWgctQ5MPuiuna8iTYkgEw-1; Thu, 23 Jun 2022 07:34:49 -0400 X-MC-Unique: FWgctQ5MPuiuna8iTYkgEw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4A591C05129; Thu, 23 Jun 2022 11:34:48 +0000 (UTC) Received: from localhost (unknown [10.33.36.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 750AA141510C; Thu, 23 Jun 2022 11:34:48 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Simplify test by not using std::log2 Date: Thu, 23 Jun 2022 12:34:47 +0100 Message-Id: <20220623113447.222685-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 11:34:53 -0000 Tested x86_64-linux, pushed to trunk. -- >8 -- This test uses std::log2 without including , but it doesn't need to use it at all. Just get the number of digits from numeric_limits instead. libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/random_device/entropy.cc: Use numeric_limits::digits. --- .../testsuite/26_numerics/random/random_device/entropy.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/entropy.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/entropy.cc index 63b7043bf9b..9f529f5d814 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/random_device/entropy.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/entropy.cc @@ -1,6 +1,7 @@ // { dg-do run { target c++11 } } #include +#include #include #include @@ -12,7 +13,7 @@ test01() VERIFY( std::random_device(token).entropy() == 0.0 ); using result_type = std::random_device::result_type; - const double max = std::log2(std::numeric_limits::max() + 1.0); + const double max = std::numeric_limits::digits; for (auto token : { "/dev/random", "/dev/urandom" }) if (__gnu_test::random_device_available(token)) -- 2.34.3