RE: [PATCH v3] kernel.h: Skip single-eval logic on literals in min()/max()

From: David Laight
Date: Tue Mar 13 2018 - 09:30:58 EST


The amount of replicated defined could also be reduced by passing > or <
to a min_max() macro.
So you start off with something like:
#define min(x, y) __min_max(x, <, y)
#define max(x, y) __min_max(x, >, y)
then have:
#define __min_max(x, cond, y) ((x) cond (y) ? (x) : (y))
in all its associated flavours.

David