From patchwork Thu Jun 23 11:34:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1647047 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=t7wKicuB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LTJBs5m0Nz9sGp for ; Thu, 23 Jun 2022 21:37:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9748B385AE51 for ; Thu, 23 Jun 2022 11:37:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9748B385AE51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1655984243; bh=xxiFhKkHMnnHHqqUly02mHhuDzwGVSimlDTkl0xaQ70=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=t7wKicuBLr3UJFI3457KtsaTF+YKxp291Of4Xys2qPg4BwvztMkuEz5bTD1zs6+Ae qY629awAkM7dOWnQvIJKwjzOGB0GEZkzfPAFsXLHm+YMBI8cS5cqHg2KpLKm4oTB7k fkkF8E0xPgDwL+tUGbl5cvKul37IYnw2jSuH+CMY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 75E2238560B2 for ; Thu, 23 Jun 2022 11:34:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75E2238560B2 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) 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 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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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))