svn commit: r240834 - head/sys/sys

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Sep 22 17:49:26 UTC 2012


Author: pjd
Date: Sat Sep 22 17:49:25 2012
New Revision: 240834
URL: http://svn.freebsd.org/changeset/base/240834

Log:
  Add rounddown2() macro similar to the roundup2() macro.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Sat Sep 22 17:47:37 2012	(r240833)
+++ head/sys/sys/param.h	Sat Sep 22 17:49:25 2012	(r240834)
@@ -275,6 +275,7 @@
 #endif
 #define	nitems(x)	(sizeof((x)) / sizeof((x)[0]))
 #define	rounddown(x, y)	(((x)/(y))*(y))
+#define	rounddown2(x, y) ((x)&(~((y)-1)))          /* if y is power of two */
 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))  /* to any y */
 #define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
 #define powerof2(x)	((((x)-1)&(x))==0)


More information about the svn-src-all mailing list