Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/xen/x86



> OT: these are a little unclear to me. Could someone outline what
> 
>       roundup
>       roundup2
>       rounddown
>       howmany

They are in <sys/param.h>.

>> #define howmany(x, y)   (((x)+((y)-1))/(y))
how many y-byte blocks are required to store x-bytes region?

>> #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
>> #define rounddown(x,y)  (((x)/(y))*(y))
roundup or rounddown x per y, as is?

>> #define roundup2(x, m)  (((x) + (m) - 1) & ~((m) - 1))
optimized version (avoid division op) roundup()
where m is a power of two

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index