summaryrefslogtreecommitdiff
path: root/src/include/c.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/c.h')
-rw-r--r--src/include/c.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/c.h b/src/include/c.h
index 81d8e642da2..3199be3054e 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -950,6 +950,14 @@ typedef NameData *Name;
*/
/*
+ * Invert the sign of a qsort-style comparison result, ie, exchange negative
+ * and positive integer values, being careful not to get the wrong answer
+ * for INT_MIN. The argument should be an integral variable.
+ */
+#define INVERT_COMPARE_RESULT(var) \
+ ((var) = ((var) < 0) ? 1 : -(var))
+
+/*
* Use this, not "char buf[BLCKSZ]", to declare a field or local variable
* holding a page buffer, if that page might be accessed as a page and not
* just a string of bytes. Otherwise the variable might be under-aligned,