From: Orestis Floros Date: Sat, 16 Sep 2017 10:43:28 +0000 (+0300) Subject: Add SWAP util macro X-Git-Tag: 4.15~82^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=71e309597c289c0ff1f7b1b87eaca8c11297b1c0;p=i3%2Fi3 Add SWAP util macro --- diff --git a/include/util.h b/include/util.h index de6fa568..526ab881 100644 --- a/include/util.h +++ b/include/util.h @@ -57,6 +57,13 @@ #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);