[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59475] trunk/blender/source/blender/ blenkernel/intern/pbvh.c: avoid double ghash lookup in sculpt map_insert_vert

Campbell Barton ideasman42 at gmail.com
Sat Aug 24 17:31:47 CEST 2013


Revision: 59475
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59475
Author:   campbellbarton
Date:     2013-08-24 15:31:47 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
avoid double ghash lookup in sculpt map_insert_vert

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/pbvh.c

Modified: trunk/blender/source/blender/blenkernel/intern/pbvh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pbvh.c	2013-08-24 15:14:50 UTC (rev 59474)
+++ trunk/blender/source/blender/blenkernel/intern/pbvh.c	2013-08-24 15:31:47 UTC (rev 59475)
@@ -245,9 +245,13 @@
                            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 @@
 		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 */




More information about the Bf-blender-cvs mailing list