svn commit: r258575 - stable/9/sys/sys

Andriy Gapon avg at FreeBSD.org
Mon Nov 25 18:51:26 UTC 2013


Author: avg
Date: Mon Nov 25 18:51:25 2013
New Revision: 258575
URL: http://svnweb.freebsd.org/changeset/base/258575

Log:
  MFC r240834: Add rounddown2() macro similar to the roundup2() macro.
  
  MFC slacker:	pjd

Modified:
  stable/9/sys/sys/param.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/sys/param.h
==============================================================================
--- stable/9/sys/sys/param.h	Mon Nov 25 18:49:37 2013	(r258574)
+++ stable/9/sys/sys/param.h	Mon Nov 25 18:51:25 2013	(r258575)
@@ -277,6 +277,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-stable-9 mailing list