Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Use a different, type-insensitive idiom for CLR().



details:   https://anonhg.NetBSD.org/src/rev/b5c93284d263
branches:  trunk
changeset: 833673:b5c93284d263
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 08 06:21:41 2018 +0000

description:
Use a different, type-insensitive idiom for CLR().

As discussed on IRC and proposed by dholland@, the existing idiom is
type-sensitive, and will likely fail silently when the flags variable
is a 64-bit type.

No functional change intended.  If anything breaks, it was probably
already broken.

diffstat:

 sys/sys/types.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 1af428a72258 -r b5c93284d263 sys/sys/types.h
--- a/sys/sys/types.h   Sun Jul 08 04:50:14 2018 +0000
+++ b/sys/sys/types.h   Sun Jul 08 06:21:41 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: types.h,v 1.98 2017/01/14 01:02:08 christos Exp $      */
+/*     $NetBSD: types.h,v 1.99 2018/07/08 06:21:41 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -345,7 +345,7 @@
 #ifdef _KERNEL
 #define SET(t, f)      ((t) |= (f))
 #define        ISSET(t, f)     ((t) & (f))
-#define        CLR(t, f)       ((t) &= ~(f))
+#define        CLR(t, f)       ((t) = ~(~(t) | (f)))
 #endif
 
 #if !defined(_KERNEL) && !defined(_STANDALONE)



Home | Main Index | Thread Index | Old Index