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/54eb842a044f
branches:  trunk
changeset: 323906:54eb842a044f
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 013a8db75646 -r 54eb842a044f 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