From 71e309597c289c0ff1f7b1b87eaca8c11297b1c0 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 16 Sep 2017 13:43:28 +0300 Subject: [PATCH] Add SWAP util macro --- include/util.h | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.39.5