On Thu, Mar 04, 2010 at 12:58:01AM +0900, Izumi Tsutsui wrote: > 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
Thanks. Maybe I should have looked before asking... Oh well, maybe the committed man-page will save someone else from asking stupid questions. - Jukka.