From patchwork Sun Jul 28 14:22:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Laight X-Patchwork-Id: 13744007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C57ACC3DA49 for ; Sun, 28 Jul 2024 14:23:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 611B36B0085; Sun, 28 Jul 2024 10:23:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E8FB6B0088; Sun, 28 Jul 2024 10:23:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B0626B0089; Sun, 28 Jul 2024 10:23:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2EF006B0085 for ; Sun, 28 Jul 2024 10:23:10 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C783C40322 for ; Sun, 28 Jul 2024 14:23:09 +0000 (UTC) X-FDA: 82389378498.23.C6ACB02 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by imf18.hostedemail.com (Postfix) with ESMTP id 8A8741C0012 for ; Sun, 28 Jul 2024 14:23:07 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf18.hostedemail.com: domain of david.laight@aculab.com designates 185.58.86.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722176584; a=rsa-sha256; cv=none; b=wXtpuNTXhgqk/9BBuCRGUtLnmKi+rFUrI1cixDha3s1ikE1vVge5JzKeuhLeyYFtuxmPPr g6VQEQKwN3iiDwRzweLm1VpbEGS+OjgAcvE3QacxgifbNULzSsYu9WNpHyiKCz9bZMYloj 62ceh1v4Jl6paIK21QOw6G6Fudwh5Qw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf18.hostedemail.com: domain of david.laight@aculab.com designates 185.58.86.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722176584; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=0tAgnZnNa7Oxzz94ggec/aR6GTvZMg8hnsCjUYlG5YQ=; b=rUTUtEPp7pD6XBN49fnBM+RrdUgiJ7SjtQSjOCJyqDlzcg8xGMAbcCaIaXB0XvK/pdRHje SEuEJK2mDPXUfmIDDyCpl0w/J+DYK9XnM9TMQt0iplOLItbFfmAst6Ui7xX3CkVpAYCPCM QWJS5/5jBEhOki1v6BK+d2hDvCKO0qY= Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-69-SvVKtw3EPaGCg6lHdtAGIQ-1; Sun, 28 Jul 2024 15:23:03 +0100 X-MC-Unique: SvVKtw3EPaGCg6lHdtAGIQ-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 28 Jul 2024 15:22:19 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sun, 28 Jul 2024 15:22:19 +0100 From: David Laight To: "'linux-kernel@vger.kernel.org'" CC: 'Linus Torvalds' , 'Jens Axboe' , "'Matthew Wilcox (Oracle)'" , 'Christoph Hellwig' , 'Andrew Morton' , 'Andy Shevchenko' , 'Dan Carpenter' , 'Arnd Bergmann' , "'Jason@zx2c4.com'" , "'pedro.falcato@gmail.com'" , 'Mateusz Guzik' , "'linux-mm@kvack.org'" , 'Lorenzo Stoakes' Subject: [PATCH v2 6/8] minmax: Optimise _Static_assert() check in clamp() Thread-Topic: [PATCH v2 6/8] minmax: Optimise _Static_assert() check in clamp() Thread-Index: Adrg+aI2g2sJGNTJQ4aVVAXDWlMAag== Date: Sun, 28 Jul 2024 14:22:19 +0000 Message-ID: References: <402c3c617c29465c898b1af55e3c6095@AcuMS.aculab.com> In-Reply-To: <402c3c617c29465c898b1af55e3c6095@AcuMS.aculab.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-Rspam-User: X-Rspamd-Queue-Id: 8A8741C0012 X-Rspamd-Server: rspam01 X-Stat-Signature: dbek4y5a6bwjjefqkqy1k1ceamnazr4b X-HE-Tag: 1722176587-619526 X-HE-Meta: U2FsdGVkX18t75icrjtXduaNlG9TBVdH5uS6YUqClKPkAfHhoEVW0zw4XmsGnAskNbMaudnKJvwlbHP0/esgEA9tGO3t04yAd2ZgBjcLXZs5hseLjyjKzRY34fNf/J0n0MD2MoWdXDP7BbHnO1bOE5HTwyFT5kV69q9RkLEpIn+rsNJ6HdvsLtEJNmY4TwZYfZyJRzd552WXoz/uluHHPpqJwlUUMMIHjzzp57n56l8aZLSaw8uhdSBVFfq7pmXc+8E+iKnMjWSTVH84wy8mqFASf0gKMvyJx+UAu1Bi6pArr4TlHURVoov8dUnYNZZFqCzjLvt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1/i9YNuPdmTbsAArn9bg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use __if_constexpr() instead of __builtin_choose_expr(__is_constexpr()). Signed-off-by: David Laight --- v2 - no change The misaligned \ is fixed in a later path. include/linux/minmax.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index a0c948ad576d..ad57c8eddc8a 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -142,8 +142,7 @@ typeof(val) unique_val = (val); \ typeof(lo) unique_lo = (lo); \ typeof(hi) unique_hi = (hi); \ - _Static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \ - (lo) <= (hi), true), \ + _Static_assert(__if_constexpr((lo) <= (hi), (lo) <= (hi), true), \ "clamp() low limit " #lo " greater than high limit " #hi); \ _Static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \ _Static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \