diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-01-21 18:19:27 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-01-21 18:50:44 +0400 |
commit | 7acb7cb8975d113a26be4e78f4eb7646192b2ea0 (patch) | |
tree | 666103e4d2b319e52b2a5b6cfd84f6b55d2dfd77 /source/blender/bmesh/tools/bmesh_beautify.c | |
parent | 7198eee88041962d7b3fa35cb4263554f5687b32 (diff) |
Replace XOR swapping by default ("naive", with extra var) one.
Ref: http://en.wikipedia.org/wiki/XOR_swap_algorithm, modern compilers/CPUs are much more efficient with "naive" algo than XOR one.
Doubled check, for me in an optimized build, XOR is several times slower than naive algo.
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_beautify.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_beautify.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index 45093f952d8..4b5c8789227 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -90,11 +90,9 @@ static GSet *erot_gset_new(void) } /* ensure v0 is smaller */ -#define EDGE_ORD(v0, v1) \ - if (v0 > v1) { \ - v0 ^= v1; \ - v1 ^= v0; \ - v0 ^= v1; \ +#define EDGE_ORD(v0, v1) \ + if (v0 > v1) { \ + SWAP(int, v0, v1); \ } (void)0 static void erot_state_ex(const BMEdge *e, int v_index[2], int f_index[2]) |