PERFORCE change 128221 for review

Kip Macy kmacy at FreeBSD.org
Sat Oct 27 19:00:40 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=128221

Change 128221 by kmacy at kmacy:storage:toestack on 2007/10/28 02:00:27

	re-make the bitmap macros expression safe
	pointed out by Sam Leffler

Affected files ...

.. //depot/projects/toestack/sys/sys/param.h#7 edit

Differences ...

==== //depot/projects/toestack/sys/sys/param.h#7 (text+ko) ====

@@ -238,10 +238,10 @@
 #define MAXSYMLINKS	32
 
 /* Bit map related macros. */
-#define	setbit(a,i)	(((uint8_t *)a)[(i)/NBBY] |= 1<<((i)%NBBY))
-#define	clrbit(a,i)	(((uint8_t *)a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
-#define	isset(a,i)	(((uint8_t *)a)[(i)/NBBY] & (1<<((i)%NBBY)))
-#define	isclr(a,i)	((((uint8_t *)a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+#define	setbit(a,i)	(((uint8_t *)(a))[(i)/NBBY] |= 1<<((i)%NBBY))
+#define	clrbit(a,i)	(((uint8_t *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define	isset(a,i)	(((uint8_t *)(a))[(i)/NBBY] & (1<<((i)%NBBY)))
+#define	isclr(a,i)	((((uint8_t *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
 
 /* Macros for counting and rounding. */
 #ifndef howmany


More information about the p4-projects mailing list