Commit 429966cd authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Cast y argument to uintmax_t in RDN2/RUP2

If the type of the y argument to RDN2/RUP2 is smaller than the type of
the x argument, these macros would fail to round correctly. Cast to
uintmax_t to avoid this problem.
parent f584202c
......@@ -128,8 +128,8 @@ void VSM_common_ageupdate(struct vsm_sc *sc);
*/
#define PWR2(x) ((((x)-1)&(x))==0) /* Is a power of two */
#define RDN2(x, y) ((x)&(~((y)-1))) /* if y is powers of two */
#define RUP2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define RDN2(x, y) ((x)&(~((uintmax_t)(y)-1))) /* PWR2(y) true */
#define RUP2(x, y) (((x)+((y)-1))&(~((uintmax_t)(y)-1))) /* PWR2(y) true */
/*--------------------------------------------------------------------
* Pointer aligment magic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment