From 91a7e2632d02a6f9b8f428693418f9e10c81d0ff Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 17 Aug 2020 12:49:07 +0200 Subject: [PATCH] utils: fix implementation of SWAP() for complex objects --- common/include/villas/utils.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common/include/villas/utils.hpp b/common/include/villas/utils.hpp index 4418e91d6..522e99fcd 100644 --- a/common/include/villas/utils.hpp +++ b/common/include/villas/utils.hpp @@ -72,11 +72,10 @@ #define ALIGN_MASK(x, m) (((uintptr_t) (x) + (m)) & ~(m)) #define IS_ALIGNED(x, a) (ALIGN(x, a) == (uintptr_t) x) -#define SWAP(x,y) do { \ - auto &_x = x; \ - auto &_y = y; \ - x = _y; \ - y = _x; \ +#define SWAP(x, y) do { \ + auto t = x; \ + x = y; \ + y = t; \ } while (0) /** Round-up integer division */