Date: Wed, 28 Jun 2006 16:26:31 +0300 From: Alex Lyashkov <shadow@psoft.net> To: Harti Brandt <harti@freebsd.org> Cc: arch@freebsd.org Subject: Re: SET, CLR, ISSET in types.h for _KERNEL builds Message-ID: <1151501191.3525.46.camel@berloga.shadowland> In-Reply-To: <20060628133928.H52624@beagle.kn.op.dlr.de> References: <20060627.135817.-490997979.imp@bsdimp.com> <1151490061.3525.9.camel@berloga.shadowland> <20060628133928.H52624@beagle.kn.op.dlr.de>
next in thread | previous in thread | raw e-mail | index | archive | help
=F7 =F3=D2=C4, 28.06.2006, =D7 14:39, Harti Brandt =D0=C9=DB=C5=D4: > On Wed, 28 Jun 2006, Alex Lyashkov wrote: >=20 > AL>=F7 =F7=D4=D2, 27.06.2006, =D7 22:58, M. Warner Losh =D0=C9=DB=C5=D4: > AL>> NetBSD recently added SET, CLR, ISSET to sys/types.h (only if _KERNE= L > AL>> is defined). I'd like to do something similar in FreeBSD. I see no > AL>> reason to needless deviate from NetBSD here. One could make an > AL>> argument for lots of different files, but at the end of the day does > AL>> it really matter enough to justify having it be different than NetBS= D? > AL>>=20 > AL>> Here's my proposed diff, inline, for your consideration: > AL>>=20 > AL> > AL>>=20 > AL>> NOTE: That /* !_KERNEL */ should have the '!' removed, but I didn't > AL>> want to confuse things by doing that too. > AL>>=20 > AL>> Comments? > AL>>=20 > AL>> Warner > AL>> _______________________________________________ > AL>Who not create abstract framework for work with bitmask more then 64bi= ts > AL>size?=20 > AL>similar this: > AL> > AL>#define_bitmask(name,size) char name[(size/8)+1]; > AL>#define set_bit(bimask,no) { bitmask[(no/8)] |=3D 1<<(no%8); } > AL>#define clr_bit(bitmask,no) { bitmask[(no/8)] &=3D ~(1<<(no%8)); } > AL>static inline isset_bit(char *bitmask, no) { > AL> return bitmask[(no/8)] & 1<<(no%8); >=20 > You mean bitstring(3)? Thanks for point this. --=20 Alex Lyashkov <shadow@psoft.net> Positive Software
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1151501191.3525.46.camel>