Date: Mon, 25 Nov 2013 18:51:25 +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-9@freebsd.org Subject: svn commit: r258575 - stable/9/sys/sys Message-ID: <201311251851.rAPIpPJ5084893@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311251851.rAPIpPJ5084893>