00001 #ifndef __LIB_ROUND_H 00002 //104464681992 00003 #define __LIB_ROUND_H 00004 00005 /* Yields X rounded up to the nearest multiple of STEP. 00006 For X >= 0, STEP >= 1 only. */ 00007 #define ROUND_UP(X, STEP) (((X) + (STEP) - 1) / (STEP) * (STEP)) 00008 00009 /* Yields X divided by STEP, rounded up. 00010 For X >= 0, STEP >= 1 only. */ 00011 #define DIV_ROUND_UP(X, STEP) (((X) + (STEP) - 1) / (STEP)) 00012 00013 /* Yields X rounded down to the nearest multiple of STEP. 00014 For X >= 0, STEP >= 1 only. */ 00015 #define ROUND_DOWN(X, STEP) ((X) / (STEP) * (STEP)) 00016 00017 /* There is no DIV_ROUND_DOWN. It would be simply X / STEP. */ 00018 00019 #endif /* lib/round.h */