X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=common.h;h=ec7913ea4b13853d1880611bf02e877348f476d8;hb=bc662e293c854e1bdc9d46e9a410fe220247e6d4;hp=172b8af5507fd700766cf071b606bf05c9aeb7d9;hpb=e16cf0578f4baaf879e4ab9d3528a765bfd29be0;p=chaz%2Frasterize diff --git a/common.h b/common.h index 172b8af..ec7913e 100644 --- a/common.h +++ b/common.h @@ -120,12 +120,15 @@ int imax(int a, int b) return a < b ? b : a; } - /* - * Define some macros for packing and unpacking bytes to and from larger ints. + * Define generic MIN and MAX macros. */ -#define PACK(W,N,B) (((B) << (8 * (N))) | ((W) & ~(0xff << (8 * (N))))) -#define UNPACK(W,N) ((uint8_t)((W) >> (8 * (N))) & 0xff) +#ifndef MIN +#define MIN(A,B) (((A) < (B)) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) (((A) > (B)) ? (A) : (B)) +#endif /* @@ -246,10 +249,11 @@ void ltrim(char *str); * Trim white space off of both sides of a string. */ INLINE_MAYBE -void trim(char *str) +char* trim(char *str) { rtrim(str); ltrim(str); + return str; }