Re: [PATCH] linux/bits.h: fix unsigned less than zero warnings

2020-06-04 Thread Rikard Falkeborn
On Thu, Jun 04, 2020 at 09:41:29AM +0300, Andy Shevchenko wrote: > On Thu, Jun 4, 2020 at 1:03 AM Rikard Falkeborn > wrote: > > > > When calling the GENMASK and GENMASK_ULL macros with zero lower bit and > > an unsigned unknown high bit, some gcc versions warn due to the > > comparisons of the hig

Re: [PATCH] linux/bits.h: fix unsigned less than zero warnings

2020-06-04 Thread Joe Perches
On Thu, 2020-06-04 at 09:41 +0300, Andy Shevchenko wrote: > I think there is still a possibility to improve (as I mentioned there > are test cases that are absent right now). > What if we will have unsigned long value 0x10001? Would it be 1 > after casting? > > Maybe cast to (long) or (long lo

Re: [PATCH] linux/bits.h: fix unsigned less than zero warnings

2020-06-03 Thread Andy Shevchenko
On Thu, Jun 4, 2020 at 1:03 AM Rikard Falkeborn wrote: > > When calling the GENMASK and GENMASK_ULL macros with zero lower bit and > an unsigned unknown high bit, some gcc versions warn due to the > comparisons of the high and low bit in GENMASK_INPUT_CHECK. > > To silence the warnings, cast the i

[PATCH] linux/bits.h: fix unsigned less than zero warnings

2020-06-03 Thread Rikard Falkeborn
When calling the GENMASK and GENMASK_ULL macros with zero lower bit and an unsigned unknown high bit, some gcc versions warn due to the comparisons of the high and low bit in GENMASK_INPUT_CHECK. To silence the warnings, cast the inputs to int before doing the comparisons. The only valid inputs to