* + kernelh-add-minmax3-macros.patch added to -mm tree
@ 2010-08-19 23:14 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2010-08-19 23:14 UTC (permalink / raw)
To: mm-commits
Cc: hagen, benh, herbert, hsweeten, joe, linux, mingo, penberg,
rolandd, sean.hefty, tglx
The patch titled
kernel.h: add {min,max}3 macros
has been added to the -mm tree. Its filename is
kernelh-add-minmax3-macros.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: kernel.h: add {min,max}3 macros
From: Hagen Paul Pfeifer <hagen@jauu.net>
Introduce two additional min/max macros to compare three operands. This
will save some cycles as well as some bytes on the stack and last but not
least more pleasing as macro nesting.
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Joe Perches <joe@perches.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kernel.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff -puN include/linux/kernel.h~kernelh-add-minmax3-macros include/linux/kernel.h
--- a/include/linux/kernel.h~kernelh-add-minmax3-macros
+++ a/include/linux/kernel.h
@@ -640,6 +640,22 @@ static inline void ftrace_dump(enum ftra
(void) (&_max1 == &_max2); \
_max1 > _max2 ? _max1 : _max2; })
+#define min3(x, y, z) ({ \
+ typeof(x) _min1 = (x); \
+ typeof(y) _min2 = (y); \
+ typeof(z) _min3 = (z); \
+ (void) (&_min1 == &_min2 == &_min3); \
+ _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
+ (_min2 < _min3 ? _min2 : _min3); })
+
+#define max3(x, y, z) ({ \
+ typeof(x) _max1 = (x); \
+ typeof(y) _max2 = (y); \
+ typeof(z) _max3 = (z); \
+ (void) (&_max1 == &_max2 == &_max3); \
+ _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
+ (_max2 > _max3 ? _max2 : _max3); })
+
/**
* clamp - return a value clamped to a given range with strict typechecking
* @val: current value
_
Patches currently in -mm which might be from hagen@jauu.net are
kernelh-add-minmax3-macros.patch
replace-nested-max-min-macros-with-maxmin3-macro.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-19 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19 23:14 + kernelh-add-minmax3-macros.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.