Date: Mon, 25 Nov 2013 18:51:53 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r258576 - stable/8/sys/sys Message-ID: <201311251851.rAPIprto084975@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Mon Nov 25 18:51:53 2013 New Revision: 258576 URL: http://svnweb.freebsd.org/changeset/base/258576 Log: MFC r240834: Add rounddown2() macro similar to the roundup2() macro. MFC slacker: pjd Modified: stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Mon Nov 25 18:51:25 2013 (r258575) +++ stable/8/sys/sys/param.h Mon Nov 25 18:51:53 2013 (r258576) @@ -273,6 +273,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311251851.rAPIprto084975>