]> git.sur5r.net Git - i3/i3/commitdiff
Add SWAP util macro
authorOrestis Floros <orestisf1993@gmail.com>
Sat, 16 Sep 2017 10:43:28 +0000 (13:43 +0300)
committerOrestis Floros <orestisf1993@gmail.com>
Sat, 16 Sep 2017 10:49:19 +0000 (13:49 +0300)
include/util.h

index de6fa56850eb8f0ba8ba89c941b921a13796b61c..526ab88107038ac583edd508466b23a40b4597be 100644 (file)
 
 #define CALL(obj, member, ...) obj->member(obj, ##__VA_ARGS__)
 
+#define SWAP(first, second, type) \
+    do {                          \
+        type tmp_SWAP = first;    \
+        first = second;           \
+        second = tmp_SWAP;        \
+    } while (0)
+
 int min(int a, int b);
 int max(int a, int b);
 bool rect_contains(Rect rect, uint32_t x, uint32_t y);