On Wed, Sep 27, 2023 at 10:30:33AM -0700, Andrew Morton wrote:
> +#define umin(x, y) \
> + __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
kmin() and kmax() are (of course!) much better names.
On Wed, Sep 27, 2023 at 10:21:41PM +0300, Alexey Dobriyan wrote:
> On Wed, Sep 27, 2023 at 10:30:33AM -0700, Andrew Morton wrote:
> > +#define umin(x, y) \
> > + __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
>
> kmin() and kmax() are (of course!) much better names.
it's unsigned, not user.
On Wed, Sep 27, 2023 at 09:00:37PM +0100, Matthew Wilcox wrote:
> On Wed, Sep 27, 2023 at 10:21:41PM +0300, Alexey Dobriyan wrote:
> > On Wed, Sep 27, 2023 at 10:30:33AM -0700, Andrew Morton wrote:
> > > +#define umin(x, y) \
> > > + __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
> >
> > kmin() and kmax() are (of course!) much better names.
>
> it's unsigned, not user.
Yes, but the same idea applies to signed types:
min, max require identical types
min_t force type
kmin, kmax are relaxed min/max versions if signednesses match.