From 1ec18b8fd9764a1fa6cae2021214f69f53fb4c8b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 17 Mar 2014 00:28:13 -0700 Subject: [PATCH] better SWAP() macro --- src/modules/autoseed.c | 4 ++-- src/util/goodies.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index 9343ab0d4..cc0d0752c 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -949,8 +949,8 @@ static void smooth_island(region_list * island) r = rlist->data; runhash(r); runhash(rn[n]); - SWAP_VARS(int, r->x, rn[n]->x); - SWAP_VARS(int, r->y, rn[n]->y); + SWAP_INTS(r->x, rn[n]->x); + SWAP_INTS(r->y, rn[n]->y); rhash(r); rhash(rn[n]); rlist->data = r; diff --git a/src/util/goodies.h b/src/util/goodies.h index 8c4d299ff..39bf6a54c 100644 --- a/src/util/goodies.h +++ b/src/util/goodies.h @@ -53,7 +53,7 @@ extern "C" { #define HASH1 JENKINS_HASH1 #define HASH2 JENKINS_HASH2 -#define SWAP_VARS(T, a, b) { T x = a; a = b; b = x; } +#define SWAP_INTS(a, b) { a^=b; b^=a; a^=b; } #ifdef __cplusplus } #endif