Add roundup2(x,y) for when y is a power of two.

This commit is contained in:
Poul-Henning Kamp 1995-10-06 09:56:26 +00:00
parent b67501dcda
commit 1784a84a1f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11263

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)param.h 8.2 (Berkeley) 1/21/94
* $Id: param.h,v 1.7 1995/02/07 03:33:05 davidg Exp $
* $Id: param.h,v 1.8 1995/05/14 03:00:05 davidg Exp $
*/
#ifndef _SYS_PARAM_H_
@ -181,7 +181,8 @@
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define rounddown(x, y) (((x)/(y))*(y))
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
#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)
/* Macros for min/max. */