Re: SET, CLR, ISSET in types.h for _KERNEL builds



On Wed, Jun 28, 2006 at 08:08:24PM +1000, Andrew Reilly wrote:
On Wed, Jun 28, 2006 at 09:53:46AM +0000, Poul-Henning Kamp wrote:
In message <20060628094221.GA50978@xxxxxxxxxxxxxxxx>, Yar Tikhiy writes:
On Tue, Jun 27, 2006 at 01:58:17PM -0600, M. Warner Losh wrote:

NetBSD recently added SET, CLR, ISSET to sys/types.h (only if _KERNEL
is defined).

As one of the people who have worked with the original /bin/sh source
code, I have a slight alergic reaction to attempts to paste over
the implementation language with macros like these.

Setting a bit in 'C' is spelled
variable |= bit;
not
SET(variable, bit);

To my eye, if you're going to use "bit" to describe which bit is
being operated on, then you should *really* be doing:
variable |= (1 << bit)
and, obviously, SET(variable, bit) should do that, rather than
what has been proposed.

That would require converting our device .h files from defining bit
masks to defining bit numbers. I don't mind you doing that as long
as SET is expanded to:

((variable) |= (1 << (bit)))

-- note the bunch of roughly balanced parentheses ;-)

--
Yar
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"