lkml.org 
[lkml]   [2024]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH net-next 02/37] rxrpc: Use umin() and umax() rather than min_t()/max_t() where possible
Date
David Laight <David.Laight@ACULAB.COM> wrote:

> > Use umin() and umax() rather than min_t()/max_t() where the type specified
> > is an unsigned type.
>
> You are also changing some max() to umax().

Good point. If I have to respin my patches again, I'll update that.

> Presumably they have always passed the type check so max() is fine.
> And max(foo, 1) would have required that 'foo' be 'signed int' and could
> potentially be negative when max(-1, 1) will be 1 but umax(-1, 1) is
> undefined.

There have been cases like this:

unsigned long timeout;
...
timeout = max(timeout, 1);

where the macro would complain because it thought "timeout" and "1" were
different sizes, so "1UL" had to be used. Using umax() deals with that issue.

David


\
 
 \ /
  Last update: 2024-12-05 11:50    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog