[PATCH]: Add some interoperability macros to sys/param.h

Nicholas Wourms nwourms@netscape.net
Thu Aug 7 19:27:00 GMT 2003


Hi,

This patch adds 11 new macros to Cygwin's sys/param.h.  They include:

setbit(a,i)
clrbit(a,i)
isset(a,i)
isclr(a,i)
howmany(x, y)
rounddown(x, y)
roundup(x, y)
roundup2(x, y)
powerof2(x)
MIN(a,b)
MAX(a,b)

I find some to be very useful for many mundane routines (esp. MIN/MAX). 
  It should be noted that I chose to add all 11 of them (as opposed to 
just the ones I use) because this subset of macros seems to be common 
across all *bsd and linux distributions.  In doing so we improve our 
interoperability and make porting easier.  Although I "peeked" at the 
param.h header on my linux box to see if they were all defined, the 
macros I used were copied verbatim from the freebsd cvs 
src/sys/sys/param.h.  Furthermore, I didn't actually check the 
definition expression in the linux header, so I feel confident that I 
have violated no licenses.  I have an assignment pending, but I was 
hoping this change would be small enough to go in before then.

Cheers,
Nicholas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Changelog.txt
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030807/bc21c1ea/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: param_h-add-macros.patch
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030807/bc21c1ea/attachment.ksh>


More information about the Cygwin-patches mailing list