summaryrefslogtreecommitdiffhomepage
path: root/ir/adt
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2014-03-29 10:13:39 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2014-04-10 10:33:55 +0200
commit1966adc74b7dc4a47f556d36628019beeb3f6d0d (patch)
treeb742c3a080dc2fd527d77849651ca2d8a547fb1a /ir/adt
parent5512229a51005fec43bac48ff09c64251b392754 (diff)
all: Add and use QSORT() and QSORT_ARR().
Diffstat (limited to 'ir/adt')
-rw-r--r--ir/adt/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/ir/adt/util.h b/ir/adt/util.h
index 26311b3..4a4c27c 100644
--- a/ir/adt/util.h
+++ b/ir/adt/util.h
@@ -45,4 +45,8 @@
*/
#define PTR_TO_INT(v) (((char *)(v) - (char *)0))
+#define QSORT(base, n, cmp) (qsort((base), (n), sizeof(*(base)), cmp))
+
+#define QSORT_ARR(base, cmp) QSORT((base), ARR_LEN((base)), (cmp))
+
#endif