public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Jan <zoo868e@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	David Laight <David.Laight@ACULAB.COM>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Herve Codina <herve.codina@bootlin.com>,
	Mark Brown <broonie@kernel.org>, Matt Jan <zoo868e@gmail.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] minmax: allow comparisons of 'long long int' against 'unsigned char/short/int'
Date: Mon,  8 Jan 2024 04:11:29 +0800	[thread overview]
Message-ID: <20240107201129.6106-1-zoo868e@gmail.com> (raw)

Since 'unsigned int' get promoted to 'signed long long int' it is safe
to compare them against an 'long long int' value.

Signed-off-by: Matt Jan <zoo868e@gmail.com>
---
 include/linux/minmax.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index 2ec559284a9f..61171286b468 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -37,7 +37,7 @@
 
 #define __types_ok(x, y) 					\
 	(__is_signed(x) == __is_signed(y) ||			\
-		__is_signed((x) + 0) == __is_signed((y) + 0) ||	\
+		__is_signed((x) + 0ll) == __is_signed((y) + 0ll) ||	\
 		__is_noneg_int(x) || __is_noneg_int(y))
 
 #define __cmp_op_min <
-- 
2.34.1


             reply	other threads:[~2024-01-07 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-07 20:11 Matt Jan [this message]
2024-01-07 20:55 ` [PATCH] minmax: allow comparisons of 'long long int' against 'unsigned char/short/int' David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240107201129.6106-1-zoo868e@gmail.com \
    --to=zoo868e@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=herve.codina@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox