From nobody Sat May 18 07:31:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588604138; cv=none; d=zohomail.com; s=zohoarc; b=FCz3c7czvJyE9NHziM41UU7alqQrMp5MPLj/1WqF54U5+bcTXNFVWTl1nIlCGvKneU7pigMGAcu5TM4W4GSxalQv8ik5FwiGUxQ7zidxJxQrFuNmY+YQvAMmObcFcBVMTxmtuF7Ev0LAMqYqvM1/TdUrT0fnVmnKQFB2qIJV/8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588604138; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=eMQaVSWAT1Z7heoa1J42qdT0AGzGArzLWWwayMp9X7M=; b=TodHqnFD/4/uRs6+VHGQaGvbHmkn3W85tUk8DCA0R9itTCX8D+lFms2x0YDdmZePHD1/PWg/PCDcE29ApOE8B+gLPIjdS9DEwsHlRNIkeAY866BHWdVYgsLHmAUWEsYcfdPPywBN/lBFluxECRguumw4o3DgOznMGxJTuAa4UG8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588604138715394.8993332926085; Mon, 4 May 2020 07:55:38 -0700 (PDT) Received: from localhost ([::1]:44436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVcVN-0001Hj-9v for importer@patchew.org; Mon, 04 May 2020 10:55:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVcHk-0002N4-GT for qemu-devel@nongnu.org; Mon, 04 May 2020 10:41:32 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:31585 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVcHj-0005UA-ID for qemu-devel@nongnu.org; Mon, 04 May 2020 10:41:32 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-JNyCsY2QOcOE78lGtBaiAw-1; Mon, 04 May 2020 10:41:29 -0400 Received: by mail-wr1-f70.google.com with SMTP id g10so2110848wrr.10 for ; Mon, 04 May 2020 07:41:29 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id q8sm13194714wmg.22.2020.05.04.07.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 07:41:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588603290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eMQaVSWAT1Z7heoa1J42qdT0AGzGArzLWWwayMp9X7M=; b=JNMdm/g833CE/cxUP69TZGZMwEH+nx3dH97LO8uOrmzylSiLV64S257pqQLxZJasFsJPR0 HsM3IrVTnbu4MqC/9f6GrH2nvzt1LzPNnlHWGGp2+BO79xDImAG8IR6yeDN2R8hzPNIz9v NwhSgoyfeKL00VzfZjin3kUsji2+Nzc= X-MC-Unique: JNyCsY2QOcOE78lGtBaiAw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EYY2f/BzJCVcOkAQoY3IgSAArpjbmfPPcJyuS6qMDqk=; b=eeEW/I3aCEm/Lo6RFJ32HuI/DtCcgju66ISy1dGQzWE5DktgNbUnc1pbdLXJD+zZdC aZu6Axp2LwLbRtY5ejXbsYqH9LaxxFPR1GZ99ANqcSIB3TXLsTlLbi3h5tPqMGN6BOZp P9ottSTxpTV1ZIkt+ew4CVhnQj83il4tHicpsPxvUMfp6TeKvYK9KpzbXHX8ZwiSjwRV JMGvIp7mbyzpmIDLrzeT83XRsmKI+RKBDFO2E+pTRMKNNH/+6Iv+YyZk90/WBYV2PPB5 vBCm1NWJSU8DBvck9JCoODEiGNimTEfISdlwUKfGW7YA7qN4fSS+ggNpWjDpjJZk3iU7 quKw== X-Gm-Message-State: AGi0PubKxWnt5mJR2LkTRiciAZ+nol07mS5cZ5LQ5P3zaJ5T39Phtte9 vqpX8d0qLCU5V1rs0RUzepGsjo1wHwqr1NXL6wgciMxnemVYHAeukoKzTqk7HnT1zGMAr42wuP7 5Alv/Bs/RFLXdTCE= X-Received: by 2002:a1c:678a:: with SMTP id b132mr15501517wmc.107.1588603287549; Mon, 04 May 2020 07:41:27 -0700 (PDT) X-Google-Smtp-Source: APiQypLKyq5yZC7ZIYhaakF/VCyQMIrDehwX1wjtXTqcZ4bOOyovHO82PyOIbOyM/gmDw6jLByyF2w== X-Received: by 2002:a1c:678a:: with SMTP id b132mr15501490wmc.107.1588603287307; Mon, 04 May 2020 07:41:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2] tests/qht-bench: Fix Clang 'int-conversion' warning Date: Mon, 4 May 2020 16:41:25 +0200 Message-Id: <20200504144125.22435-1-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:21:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , "Emilio G . Cota" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Bulekov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" When building with Clang 10 on Fedora 32, we get: tests/qht-bench.c:287:29: error: implicit conversion from 'unsigned long'= to 'double' changes value from 18446744073709551615 to 1844674407370955161= 6 [-Werror,-Wimplicit-int-float-conversion] *threshold =3D rate * UINT64_MAX; ~ ^~~~~~~~~~ /usr/include/stdint.h:130:23: note: expanded from macro 'UINT64_MAX' # define UINT64_MAX (__UINT64_C(18446744073709551615)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stdint.h:107:25: note: expanded from macro '__UINT64_C' # define __UINT64_C(c) c ## UL ^~~~~~~ :14:1: note: expanded from here 18446744073709551615UL ^~~~~~~~~~~~~~~~~~~~~~ Fix by using nextafter() from : double nextafter( double from, double to ); Returns the next representable value of 'from' in the direction of 'to'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Since v1: nextafterf() -> nextafter() Cc: Emilio G. Cota Cc: Alex Benn=C3=A9e Cc: Richard Henderson Cc: Alexander Bulekov --- tests/qht-bench.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qht-bench.c b/tests/qht-bench.c index e3b512f26f..54ce1e8188 100644 --- a/tests/qht-bench.c +++ b/tests/qht-bench.c @@ -10,6 +10,7 @@ #include "qemu/qht.h" #include "qemu/rcu.h" #include "qemu/xxhash.h" +#include =20 struct thread_stats { size_t rd; @@ -284,7 +285,7 @@ static void do_threshold(double rate, uint64_t *thresho= ld) if (rate =3D=3D 1.0) { *threshold =3D UINT64_MAX; } else { - *threshold =3D rate * UINT64_MAX; + *threshold =3D rate * nextafter(0x1p64, 0.0); } } =20 --=20 2.21.3