[Bf-blender-cvs] [ce0ff26] master: GHash: generic comparison for int[4]

Campbell Barton noreply at git.blender.org
Tue Jul 29 23:31:05 CEST 2014


Commit: ce0ff266e988bf605e27ae8c393a7f74b2763d53
Author: Campbell Barton
Date:   Wed Jul 30 07:30:18 2014 +1000
Branches: master
https://developer.blender.org/rBce0ff266e988bf605e27ae8c393a7f74b2763d53

GHash: generic comparison for int[4]

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

M	source/blender/blenlib/BLI_ghash.h
M	source/blender/blenlib/intern/BLI_ghash.c
M	source/blender/bmesh/tools/bmesh_beautify.c

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

diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index dc29a12..313c419 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -139,6 +139,9 @@ unsigned int    BLI_ghashutil_uinthash(unsigned int key);
 unsigned int    BLI_ghashutil_uinthash_v4(const unsigned int key[4]);
 #define         BLI_ghashutil_inthash_v4_p \
    ((GSetHashFP)BLI_ghashutil_uinthash_v4)
+int BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b);
+#define         BLI_ghashutil_inthash_v4_cmp \
+                BLI_ghashutil_uinthash_v4_cmp
 unsigned int    BLI_ghashutil_inthash_p(const void *ptr);
 int             BLI_ghashutil_intcmp(const void *a, const void *b);
 
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index d24c180..6b818ed 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -704,6 +704,11 @@ unsigned int BLI_ghashutil_uinthash_v4(const unsigned int key[4])
 	return hash;
 }
 
+int BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b)
+{
+	return memcmp(a, b, sizeof(unsigned int[4]));
+}
+
 unsigned int BLI_ghashutil_uinthash(unsigned int key)
 {
 	key += ~(key << 16);
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c
index b9bd7a3..6639e76 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.c
+++ b/source/blender/bmesh/tools/bmesh_beautify.c
@@ -67,6 +67,7 @@ static unsigned int erot_gsetutil_hash(const void *ptr)
 	return BLI_ghashutil_inthash_v4(&e_state->v1);
 }
 #endif
+#if 0
 static int erot_gsetutil_cmp(const void *a, const void *b)
 {
 	const EdRotState *e_state_a = (const EdRotState *)a;
@@ -81,10 +82,10 @@ static int erot_gsetutil_cmp(const void *a, const void *b)
 	else if (e_state_a->f2 > e_state_b->f2) return  1;
 	else                                    return  0;
 }
-
+#endif
 static GSet *erot_gset_new(void)
 {
-	return BLI_gset_new(BLI_ghashutil_inthash_v4_p, erot_gsetutil_cmp, __func__);
+	return BLI_gset_new(BLI_ghashutil_inthash_v4_p, BLI_ghashutil_inthash_v4_cmp, __func__);
 }
 
 /* ensure v0 is smaller */




More information about the Bf-blender-cvs mailing list