better SWAP() macro

This commit is contained in:
Enno Rehling 2014-03-17 00:28:13 -07:00
parent 6e3ed568ea
commit 1ec18b8fd9
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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