From: Martin Mares Date: Sat, 20 Nov 2004 12:55:12 +0000 (+0000) Subject: Introduced COMPARE_LT and COMPARE_GT for comparison functions for arraysort. X-Git-Tag: holmes-import~863 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a4cbca22d2cd36ae0c52f6ec868c7b0225e453c9;p=libucw.git Introduced COMPARE_LT and COMPARE_GT for comparison functions for arraysort. --- diff --git a/lib/lib.h b/lib/lib.h index c2ec50b0..5eb05441 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -40,8 +40,11 @@ #define STRINGIFY(x) #x #define GLUE(x,y) x##y #define GLUE_(x,y) x##_##y + #define COMPARE(x,y) do { if ((x)<(y)) return -1; if ((x)>(y)) return 1; } while(0) #define REV_COMPARE(x,y) COMPARE(y,x) +#define COMPARE_LT(x,y) do { if ((x)<(y)) return 1; if ((x)>(y)) return 0; } while(0) +#define COMPARE_GT(x,y) COMPARE_LT(y,x) /* Logging */