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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-07-30 01:30:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-07-30 01:30:18 +0400
commitce0ff266e988bf605e27ae8c393a7f74b2763d53 (patch)
tree58c5fca202e68c8d92a97255e908637ddc3ad3ee /source
parentc4dd294f407fcfb12e7c1451a3aaae41b0a0114a (diff)
GHash: generic comparison for int[4]
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_ghash.h3
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c5
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.c5
3 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index dc29a129dbf..313c4190a30 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 d24c180dae6..6b818ed36cb 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 b9bd7a381be..6639e767e77 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 */