diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/pm_c_util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/util/pm_c_util.h b/lib/util/pm_c_util.h index f21a2f82..db159284 100644 --- a/lib/util/pm_c_util.h +++ b/lib/util/pm_c_util.h @@ -15,6 +15,14 @@ #define ROUND(X) (((X) >= 0) ? (int)((X)+0.5) : (int)((X)-0.5)) #undef ROUNDU #define ROUNDU(X) ((unsigned int)((X)+0.5)) + +/* ROUNDUP rounds up to a specified multiple. E.g. ROUNDUP(22, 8) == 24 */ + +#undef ROUNDUP +#define ROUNDUP(X,M) (((X)+(M)-1)/(M)*(M)) +#undef ROUNDDN +#define ROUNDDN(X,M) ((X)/(M)*(M)) + #undef SQR #define SQR(a) ((a)*(a)) |