doc:document roundup, rounddown and variants.
This commit is contained in:
parent
d091a404e8
commit
e159ac072b
|
|
@ -246,9 +246,22 @@
|
||||||
#ifndef howmany
|
#ifndef howmany
|
||||||
#define howmany(x, y) (((x)+((y)-1))/(y))
|
#define howmany(x, y) (((x)+((y)-1))/(y))
|
||||||
#endif
|
#endif
|
||||||
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
/*
|
||||||
|
* Integer round x up to a multiple of y
|
||||||
|
*/
|
||||||
|
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||||
|
/*
|
||||||
|
* Integer round x down to a multiple of y
|
||||||
|
*/
|
||||||
#define rounddown(x,y) (((x)/(y))*(y))
|
#define rounddown(x,y) (((x)/(y))*(y))
|
||||||
|
/*
|
||||||
|
* Integer round x up to a multiple of m assuming
|
||||||
|
* m is a power of two
|
||||||
|
*/
|
||||||
#define roundup2(x, m) (((x) + (m) - 1) & ~((m) - 1))
|
#define roundup2(x, m) (((x) + (m) - 1) & ~((m) - 1))
|
||||||
|
/*
|
||||||
|
* determine if x is a power of two
|
||||||
|
*/
|
||||||
#define powerof2(x) ((((x)-1)&(x))==0)
|
#define powerof2(x) ((((x)-1)&(x))==0)
|
||||||
|
|
||||||
/* Macros for min/max. */
|
/* Macros for min/max. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user