From patchwork Wed Jul 24 14:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Laight X-Patchwork-Id: 13741017 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 69772C3DA63 for ; Wed, 24 Jul 2024 14:33:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 083AE6B0093; Wed, 24 Jul 2024 10:33:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 033996B0095; Wed, 24 Jul 2024 10:33:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3D836B0096; Wed, 24 Jul 2024 10:33:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C4CE16B0093 for ; Wed, 24 Jul 2024 10:33:10 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7F87D120A3F for ; Wed, 24 Jul 2024 14:33:10 +0000 (UTC) X-FDA: 82374888540.16.55965AF Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by imf09.hostedemail.com (Postfix) with ESMTP id 2D138140036 for ; Wed, 24 Jul 2024 14:33:07 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf09.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721831553; a=rsa-sha256; cv=none; b=vpo1yLvqJYF3vC6GjLSC0eqo6yaay+dZ++7miEmzu//MPh89ILFwFsENvHfBmesourLHW/ BbZLxgsGWxu6bK5iur8H1F38KC5qpUSs40GpY9JxorFh/N7ZZlQv/buO4SQs0P05lekYQn 7nEuM8JWx4uZ7BZT34lV8ta7pZ8zDtg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf09.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.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=1721831553; 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=QDy57ZVQoNG35uF/IJ1jWNERroyPlmeJLF5V2Pdwlk8=; b=K/Vvpb6BeoAPU11knYE8lj8zyxS5Fez9m22wz3SPJ3oLd6kc3Oe0m3DmSCw4FRBu5F9gp1 tz8Id7xbSJGenUOdQXMT29a6qPkaAuNCl1OmgK6999mhP8S1/E5bSFkTqXRRd24Vxcpb6p hmWdnJma0KndeHMoWFfMv02awFVHyv0= 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-312-401NOTxeOC-NAXlBON6hgw-1; Wed, 24 Jul 2024 15:33:03 +0100 X-MC-Unique: 401NOTxeOC-NAXlBON6hgw-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 24 Jul 2024 15:32:23 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 24 Jul 2024 15:32:23 +0100 From: David Laight To: "'linux-kernel@vger.kernel.org'" , "'Linus Torvalds'" CC: "'Matthew Wilcox (Oracle)'" , 'Christoph Hellwig' , 'Andrew Morton' , "'Andy Shevchenko'" , 'Dan Carpenter' , 'Arnd Bergmann' , "'Jason@zx2c4.com'" , "'hch@infradead.org'" , "'pedro.falcato@gmail.com'" , 'Mateusz Guzik' , "'linux-mm@kvack.org'" Subject: [PATCH 6/7] minmax: Optimise _Static_assert() check in clamp() Thread-Topic: [PATCH 6/7] minmax: Optimise _Static_assert() check in clamp() Thread-Index: Adrd1mBpxXCRV5VDT5OkO29yw5aIOQ== Date: Wed, 24 Jul 2024 14:32:22 +0000 Message-ID: <46f446f61c4f4304b756e38a19782ed9@AcuMS.aculab.com> References: <23bdb6fc8d884ceebeb6e8b8653b8cfe@AcuMS.aculab.com> In-Reply-To: <23bdb6fc8d884ceebeb6e8b8653b8cfe@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-Rspamd-Queue-Id: 2D138140036 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 5nj6ruf3smj6aeex319buf79swsuyyym X-HE-Tag: 1721831587-698555 X-HE-Meta: U2FsdGVkX1/RMRRT9DCyhSgZe4d0kK26Y8MVFKy9QsZQFi7GCPk7e1AN3wIljxybuCBq7TRW6umeAQhx9S++K+wBx5zjmmqyYa54IgLLMwmOGlr+gBtdxKz/ubAtYbiPdIdaihSAD01SMNFb4LIvK7QQv3/g1QkXWzSpzHsWo9xSo0JWDVp2oxpqUTeRooha9EHsraRbWtYzD8ASGYIhA5lxuXvZzsmAN1fk3mw+5wbZvFidVQG+LvG1ba333XtmTwURQfACfPYh1FXeFaO8SNdS+HLmhur0QnaEtlG6AGAOIB02zdepdbFOPo/j+hc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/XlVyqpuHRwje48ZTJPYoLI9C6ojfoc44ErDL 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 --- 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 e250957036a1..2fb63efbeb0e 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -139,8 +139,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"); \