Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-01-21 18:19:27 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-01-21 18:50:44 +0400
commit7acb7cb8975d113a26be4e78f4eb7646192b2ea0 (patch)
tree666103e4d2b319e52b2a5b6cfd84f6b55d2dfd77 /source/blender/blenlib/intern/edgehash.c
parent7198eee88041962d7b3fa35cb4263554f5687b32 (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/blenlib/intern/edgehash.c')
-rw-r--r--source/blender/blenlib/intern/edgehash.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 50dcd01207d..1d0c9b20550 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -59,11 +59,9 @@ static const unsigned int _ehash_hashsizes[] = {
#endif
/* 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(unsigned int, v0, v1); \
} (void)0
/***/