On Fri, Oct 5, 2018 at 3:12 PM Tom Lane <t...@sss.pgh.pa.us> wrote:
> Here's a draft patch against HEAD for this.

+ * 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_SIGN(var) \
+    ((var) = ((var) < 0) ? 1 : -(var))

I suppose someone might mistake this for a function that converts -42
to 42... would something like INVERT_COMPARE_RESULT() be better?

-- 
Thomas Munro
http://www.enterprisedb.com

Reply via email to