Message ID | ad23cf377fdb44be8b5ae53b33ee95a7@AcuMS.aculab.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2381861vqg; Tue, 25 Jul 2023 03:51:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEBvl91HIPgRdV8CIEuydaPsqIjDGEwc++X4IEfSArDQXmhLeib/GTDPsIRM/1v13f47TF X-Received: by 2002:a05:6a20:2d5:b0:125:f3d8:e65b with SMTP id 21-20020a056a2002d500b00125f3d8e65bmr11819427pzb.18.1690282311806; Tue, 25 Jul 2023 03:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690282311; cv=none; d=google.com; s=arc-20160816; b=q3tcY2XS8qdKFqpXRb0T40lZSLYZPWUys/FVLDWtsRQ5FdUCxr/iVyG6oVtdAhb5kA 45noC5u0xbVwZskkML0MxwEBdQLH+Amnm8ba0nhJQNM/nfpPZHaCcQ0dIBbIQEvPgUr0 P97bhWq1T0NuRkXaBrHv4u4fxY1FREN0NKY42lDUa/lvj9wXdfy6Wq0e3HVvJQyFenkC zgYeQJrAU//3VItVoYjJ+o1LAMwWQmoEUmvR6uaGCtLxN6ZwSuCAFv9Ec7u2/Fs+gFhB 1aqL4DtAJ1MGFTrdrM3LwiJvxhO4OgyekYY/2STsu2XLTU22IAshLMLL8sY9B8a5YAMc pO6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:message-id:date:thread-index :thread-topic:subject:to:from; bh=rQGfHQTSGqPe1BPh3lU/MRurhVdFtyeZy4BwRI8rBZA=; fh=6LDawf1JAWamBn08sBajPnNnIEu8LybObHHZW9kFGho=; b=McJe2ey8T9w7gxD9mgjp5OR1JWKppkBvwWOHh9K+42y16iuX780U6yoNNLhj5UTTiD Ez+vI/uxCglmQ2HP4TqX+uSZDmOh8DWPDlBQtGdI/npinfwheuFJkb/BbatNNJy/1Ly8 lW5TTTaZ7lpkhhW4XSpVR4kYQcLMfVkhdQVRaF79uV9VCy9/WVlopwgEh67ql1T502XD SeIvwygZ4TX3lSA17gXPZaVLYcxCkgZBMfNCtMkJ8jHodaMBEx1kSiGDfiSy70jMxP0h 8yBmT4ItFflzcO/dmiwbc2C46eqjJs/6Z7HcW5U1gCSu6OokAZ2yNNymBRqJziy6uh/l /3EQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170902650600b001b3bd85f54bsi11078289plk.35.2023.07.25.03.51.38; Tue, 25 Jul 2023 03:51:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbjGYKBf convert rfc822-to-8bit (ORCPT <rfc822;kloczko.tomasz@gmail.com> + 99 others); Tue, 25 Jul 2023 06:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbjGYKBD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 06:01:03 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ED4310CC for <linux-kernel@vger.kernel.org>; Tue, 25 Jul 2023 03:01:01 -0700 (PDT) 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-106-t_-S1qfXMXC8FYvyIudf1w-1; Tue, 25 Jul 2023 11:00:59 +0100 X-MC-Unique: t_-S1qfXMXC8FYvyIudf1w-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; Tue, 25 Jul 2023 11:00:58 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Tue, 25 Jul 2023 11:00:58 +0100 From: David Laight <David.Laight@ACULAB.COM> To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>, 'Andrew Morton' <akpm@linux-foundation.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Christoph Hellwig <hch@infradead.org>, "Jason A. Donenfeld" <Jason@zx2c4.com> Subject: [PATCH next 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'. Thread-Topic: [PATCH next 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'. Thread-Index: Adm+2sjvX0bUWWzzTwubPg2+xZ3MuA== Date: Tue, 25 Jul 2023 10:00:57 +0000 Message-ID: <ad23cf377fdb44be8b5ae53b33ee95a7@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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772389465301397033 X-GMAIL-MSGID: 1772389465301397033 |
Series |
[next,1/5] minmax: Add min_unsigned(a, b) and max_unsigned(a, b)
|
|
Commit Message
David Laight
July 25, 2023, 10 a.m. UTC
Since 'unsigned char/short' get promoted to 'signed int' it is
safe to compare them against an 'int' value.
Signed-off-by: David Laight <david.laight@aculab.com>
---
include/linux/minmax.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 179034479d5e..baffbe5c855d 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -16,7 +16,8 @@ * allocation usage). */ #define __types_ok(x, y) \ - (is_signed_type(typeof(x)) == is_signed_type(typeof(y))) + (is_signed_type(typeof(x)) == is_signed_type(typeof(y)) || \ + is_signed_type(typeof((x) + 0)) == is_signed_type(typeof((y) + 0))) #define __cmp_op_min < #define __cmp_op_max >