[Bf-blender-cvs] [55c4889] master: bvhutils: remove bitmap counting

Campbell Barton noreply at git.blender.org
Thu May 5 22:09:36 CEST 2016


Commit: 55c4889864dace4e00d1266637f3450dbcbf951d
Author: Campbell Barton
Date:   Fri May 6 06:10:37 2016 +1000
Branches: master
https://developer.blender.org/rB55c4889864dace4e00d1266637f3450dbcbf951d

bvhutils: remove bitmap counting

All callers pass in valid number

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

M	source/blender/blenkernel/intern/bvhutils.c

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

diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index a2998e8..660412d 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -396,15 +396,10 @@ static BVHTree *bvhtree_from_editmesh_verts_create_tree(
 	BVHTree *tree = NULL;
 	int i;
 	BM_mesh_elem_table_ensure(em->bm, BM_VERT);
-	if (verts_mask && verts_num_active == -1) {
-		verts_num_active = 0;
-		for (i = 0; i < verts_num; i++) {
-			if (BLI_BITMAP_TEST_BOOL(verts_mask, i)) {
-				verts_num_active++;
-			}
-		}
+	if (verts_mask) {
+		BLI_assert(IN_RANGE(verts_num_active, 0, verts_num));
 	}
-	else if (!verts_mask) {
+	else {
 		verts_num_active = verts_num;
 	}
 
@@ -434,13 +429,8 @@ static BVHTree *bvhtree_from_mesh_verts_create_tree(
 	BVHTree *tree = NULL;
 	int i;
 	if (vert) {
-		if (verts_mask && verts_num_active == -1) {
-			verts_num_active = 0;
-			for (i = 0; i < verts_num; i++) {
-				if (BLI_BITMAP_TEST_BOOL(verts_mask, i)) {
-					verts_num_active++;
-				}
-			}
+		if (verts_mask) {
+			BLI_assert(IN_RANGE(verts_num_active, 0, verts_num));
 		}
 		else if (!verts_mask) {
 			verts_num_active = verts_num;
@@ -697,15 +687,10 @@ static BVHTree *bvhtree_from_mesh_faces_create_tree(
 	int i;
 
 	if (faces_num) {
-		if (faces_mask && faces_num_active == -1) {
-			faces_num_active = 0;
-			for (i = 0; i < faces_num; i++) {
-				if (BLI_BITMAP_TEST_BOOL(faces_mask, i)) {
-					faces_num_active++;
-				}
-			}
+		if (faces_mask) {
+			BLI_assert(IN_RANGE(faces_num_active, 0, faces_num));
 		}
-		else if (!faces_mask) {
+		else {
 			faces_num_active = faces_num;
 		}




More information about the Bf-blender-cvs mailing list