X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=para.h;h=f095a6aa385d2f717048f1e25e15741a15632617;hp=1dcbb6d32a134db962abe7eb4e2a457c53d7f3fe;hb=1199398188c1a5ee0e8bc147400d8532bc874700;hpb=f4b28c16b93699723d42c46facec2e7b4d2d71df diff --git a/para.h b/para.h index 1dcbb6d3..f095a6aa 100644 --- a/para.h +++ b/para.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2010 Andre Noll + * Copyright (C) 1997-2011 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -70,7 +70,7 @@ /** Version text used by various commands if -V switch was given. */ #define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \ " (" GIT_VERSION ": " CODENAME ")" "\n" \ - "Copyright (C) 2010 Andre Noll\n" \ + "Copyright (C) 2011 Andre Noll\n" \ "This is free software with ABSOLUTELY NO WARRANTY." \ " See COPYING for details.\n" \ "Written by Andre Noll.\n" \ @@ -165,6 +165,16 @@ _static_inline_ long int para_random(unsigned max) return ((max + 0.0) * (random() / (RAND_MAX + 1.0))); } +/** Round up x to next multiple of y. */ +#define ROUND_UP(x, y) ({ \ + const typeof(y) _divisor = y; \ + ((x) + _divisor - 1) / _divisor * _divisor; }) + +/** Round down x to multiple of y. */ +#define ROUND_DOWN(x, y) ({ \ + const typeof(y) _divisor = y; \ + (x) / _divisor * _divisor; }) + /** Divide and round up to next integer. */ #define DIV_ROUND_UP(x, y) ({ \ typeof(y) _divisor = y; \