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:
authorCampbell Barton <ideasman42@gmail.com>2013-08-24 19:31:47 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-24 19:31:47 +0400
commit2c556c2ef72bf96a8ad178a0855c81d76e0e35de (patch)
tree5ba4a101b1c72950f2d38253ecfbc1689470b553 /source/blender
parent4b1fc0593ec790b30c211a2d8edbbc47577f6c76 (diff)
avoid double ghash lookup in sculpt map_insert_vert
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/pbvh.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 4f8536e8962..3907f4d8082 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -245,9 +245,13 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
unsigned int *face_verts,
unsigned int *uniq_verts, int vertex)
{
- void *value, *key = SET_INT_IN_POINTER(vertex);
+ void *key, **value_p;
- if (!BLI_ghash_haskey(map, key)) {
+ key = SET_INT_IN_POINTER(vertex);
+ value_p = BLI_ghash_lookup_p(map, key);
+
+ if (value_p == NULL) {
+ void *value;
if (BLI_BITMAP_GET(bvh->vert_bitmap, vertex)) {
value = SET_INT_IN_POINTER(~(*face_verts));
++(*face_verts);
@@ -261,8 +265,9 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
BLI_ghash_insert(map, key, value);
return GET_INT_FROM_POINTER(value);
}
- else
- return GET_INT_FROM_POINTER(BLI_ghash_lookup(map, key));
+ else {
+ return GET_INT_FROM_POINTER(*value_p);
+ }
}
/* Find vertices used by the faces in this node and update the draw buffers */