From owner-freebsd-arch@FreeBSD.ORG Wed Jun 28 15:56:44 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 768B916A403 for ; Wed, 28 Jun 2006 15:56:44 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15BC343D78 for ; Wed, 28 Jun 2006 15:56:43 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [IPv6:::1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k5SFtT97046337; Wed, 28 Jun 2006 09:55:29 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 28 Jun 2006 09:55:27 -0600 (MDT) Message-Id: <20060628.095527.-432838142.imp@bsdimp.com> To: shadow@psoft.net From: "M. Warner Losh" In-Reply-To: <1151490061.3525.9.camel@berloga.shadowland> References: <20060627.135817.-490997979.imp@bsdimp.com> <1151490061.3525.9.camel@berloga.shadowland> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=koi8-r Content-Transfer-Encoding: quoted-printable Cc: arch@freebsd.org Subject: Re: SET, CLR, ISSET in types.h for _KERNEL builds X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2006 15:56:44 -0000 In message: <1151490061.3525.9.camel@berloga.shadowland> Alex Lyashkov writes: : =F7 =F7=D4=D2, 27.06.2006, =D7 22:58, M. Warner Losh =D0=C9=DB=C5=D4:= : > NetBSD recently added SET, CLR, ISSET to sys/types.h (only if _KERN= EL : > is defined). I'd like to do something similar in FreeBSD. I see n= o : > reason to needless deviate from NetBSD here. One could make an : > argument for lots of different files, but at the end of the day doe= s : > it really matter enough to justify having it be different than NetB= SD? : > = : > Here's my proposed diff, inline, for your consideration: : > = : = : > = : > NOTE: That /* !_KERNEL */ should have the '!' removed, but I didn't= : > want to confuse things by doing that too. : > = : > Comments? : > = : > Warner : > _______________________________________________ : Who not create abstract framework for work with bitmask more then 64b= its : size? = : similar this: : = : #define_bitmask(name,size) char name[(size/8)+1]; : #define set_bit(bimask,no) { bitmask[(no/8)] |=3D 1<<(no%8); } : #define clr_bit(bitmask,no) { bitmask[(no/8)] &=3D ~(1<<(no%8)); } : static inline isset_bit(char *bitmask, no) { : return bitmask[(no/8)] & 1<<(no%8); : } This isn't about 'frameworks' but rather a simple set of macros to aid in the porting of code from other systems. Warner