Commit d433a3e9 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

utils: Introduce SWAP() helper to exchange two variables

Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 4c68ed7d
...@@ -85,6 +85,13 @@ ...@@ -85,6 +85,13 @@
type __max2 = (y); \ type __max2 = (y); \
__max1 > __max2 ? __max1: __max2; }) __max1 > __max2 ? __max1: __max2; })
#define SWAP(x, y) \
do { \
typeof(x) ____val = x; \
x = y; \
y = ____val; \
} while (0)
#define is_log2(v) (((v) & ((v) - 1)) == 0) #define is_log2(v) (((v) & ((v) - 1)) == 0)
#endif /* __CR_COMPILER_H__ */ #endif /* __CR_COMPILER_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment