Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Remove dependency of __BITS on MAX/MIN by providing ...



details:   https://anonhg.NetBSD.org/src/rev/661303e35864
branches:  trunk
changeset: 834402:661303e35864
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Aug 12 10:43:04 2018 +0000

description:
Remove dependency of __BITS on MAX/MIN by providing __MAX/__MIN

diffstat:

 sys/sys/cdefs.h |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 7b35c007352f -r 661303e35864 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Sun Aug 12 09:59:30 2018 +0000
+++ b/sys/sys/cdefs.h   Sun Aug 12 10:43:04 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.135 2017/12/26 17:08:56 christos Exp $     */
+/*     $NetBSD: cdefs.h,v 1.136 2018/08/12 10:43:04 skrll Exp $        */
 
 /* * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -578,9 +578,13 @@
     (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \
     ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1))))
 
+/* Macros for min/max. */
+#define        __MIN(a,b)      ((/*CONSTCOND*/(a)<(b))?(a):(b))
+#define        __MAX(a,b)      ((/*CONSTCOND*/(a)>(b))?(a):(b))
+
 /* __BITS(m, n): bits m through n, m < n. */
 #define        __BITS(__m, __n)        \
-       ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
+       ((__BIT(__MAX((__m), (__n)) + 1) - 1) ^ (__BIT(__MIN((__m), (__n))) - 1))
 #endif /* !__ASSEMBLER__ */
 
 /* find least significant bit that is set */



Home | Main Index | Thread Index | Old Index