diff options
author | pjd <pjd@FreeBSD.org> | 2012-09-22 17:49:25 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2012-09-22 17:49:25 +0000 |
commit | 7ea6c49b3385486613bed5ff6bbbbc4e0df9af2f (patch) | |
tree | f5343b9539d4b8d3df11dd6d1b76d8b026447389 | |
parent | 8f211dfb855bf5e8673edaef610eb5dfbc29e8b9 (diff) | |
download | FreeBSD-src-7ea6c49b3385486613bed5ff6bbbbc4e0df9af2f.zip FreeBSD-src-7ea6c49b3385486613bed5ff6bbbbc4e0df9af2f.tar.gz |
Add rounddown2() macro similar to the roundup2() macro.
-rw-r--r-- | sys/sys/param.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/param.h b/sys/sys/param.h index b8ac444..d1bb660 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -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) |