mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 07:15:31 +00:00
utils: Introduce SWAP() helper to exchange two variables
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
4c68ed7d7e
commit
d433a3e902
@@ -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__ */
|
||||||
|
Reference in New Issue
Block a user