diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_edgehash.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 13 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 10 |
4 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index a5ec69cae3a..a0455489d24 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -106,6 +106,8 @@ bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1); void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1); bool BLI_edgeset_haskey(EdgeSet *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT; void BLI_edgeset_free(EdgeSet *es); +void BLI_edgeset_flag_set(EdgeSet *es, unsigned int flag); +void BLI_edgeset_flag_clear(EdgeSet *es, unsigned int flag); /* rely on inline api for now */ BLI_INLINE EdgeSetIterator *BLI_edgesetIterator_new(EdgeSet *gs) { return (EdgeSetIterator *)BLI_edgehashIterator_new((EdgeHash *)gs); } diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 313c4190a30..dd3f62cd6d3 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -192,6 +192,8 @@ GSet *BLI_gset_new_ex(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; int BLI_gset_size(GSet *gs) ATTR_WARN_UNUSED_RESULT; +void BLI_gset_flag_set(GSet *gs, unsigned int flag); +void BLI_gset_flag_clear(GSet *gs, unsigned int flag); void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp); void BLI_gset_insert(GSet *gh, void *key); bool BLI_gset_add(GSet *gs, void *key); diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 1227623be94..74d7fdc88cb 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -972,6 +972,17 @@ void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp) { BLI_ghash_free((GHash *)gs, keyfreefp, NULL); } + +void BLI_gset_flag_set(GSet *gs, unsigned int flag) +{ + ((GHash *)gs)->flag |= flag; +} + +void BLI_gset_flag_clear(GSet *gs, unsigned int flag) +{ + ((GHash *)gs)->flag &= ~flag; +} + /** \} */ @@ -1010,6 +1021,8 @@ GSet *BLI_gset_pair_new(const char *info) /** * Measure how well the hash function performs * (1.0 is approx as good as random distribution). + * + * Smaller is better! */ double BLI_ghash_calc_quality(GHash *gh) { diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index f6e4aec9624..4ed82f8a473 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -622,6 +622,16 @@ void BLI_edgeset_free(EdgeSet *es) BLI_edgehash_free((EdgeHash *)es, NULL); } +void BLI_edgeset_flag_set(EdgeSet *es, unsigned int flag) +{ + ((EdgeHash *)es)->flag |= flag; +} + +void BLI_edgeset_flag_clear(EdgeSet *es, unsigned int flag) +{ + ((EdgeHash *)es)->flag &= ~flag; +} + /** \} */ /** \name Debugging & Introspection |