[Bf-blender-cvs] [1ebf5fc] temp-ghash-experiments: Minor optimization to strcmp hash helper - if both pointers are the same, then strings are the same...

Bastien Montagne noreply at git.blender.org
Tue Mar 3 09:02:00 CET 2015


Commit: 1ebf5fc9edc99575b6dc028a745d430fcb177d78
Author: Bastien Montagne
Date:   Sun Mar 1 21:48:31 2015 +0100
Branches: temp-ghash-experiments
https://developer.blender.org/rB1ebf5fc9edc99575b6dc028a745d430fcb177d78

Minor optimization to strcmp hash helper - if both pointers are the same, then strings are the same...

===================================================================

M	source/blender/blenlib/intern/BLI_ghash.c

===================================================================

diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 3cd8c79..99a14f8 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -1081,7 +1081,7 @@ unsigned int BLI_ghashutil_strhash_p_murmur(const void *ptr)
 }
 bool BLI_ghashutil_strcmp(const void *a, const void *b)
 {
-	return (!STREQ(a, b));
+	return (a == b) ? false : !STREQ(a, b);
 }
 
 GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second)




More information about the Bf-blender-cvs mailing list