[Bf-blender-cvs] [bca69783472] master: Cleanup: use index syntax instead of addition

Campbell Barton noreply at git.blender.org
Sat May 6 19:21:44 CEST 2017


Commit: bca697834728fd12c84941aa2a428abfe2090b27
Author: Campbell Barton
Date:   Sun May 7 03:12:39 2017 +1000
Branches: master
https://developer.blender.org/rBbca697834728fd12c84941aa2a428abfe2090b27

Cleanup: use index syntax instead of addition

Harmless but made accessing the first element read strangely.

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

M	source/blender/blenlib/intern/BLI_kdopbvh.c

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

diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 98044aa4f8d..857c2a5201c 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -796,7 +796,7 @@ static void non_recursive_bvh_div_nodes_task_cb(void *userdata, const int j)
 
 	int k;
 	const int parent_level_index = j - data->i;
-	BVHNode *parent = data->branches_array + j;
+	BVHNode *parent = &data->branches_array[j];
 	int nth_positions[MAX_TREETYPE + 1];
 	char split_axis;
 
@@ -835,7 +835,7 @@ static void non_recursive_bvh_div_nodes_task_cb(void *userdata, const int j)
 		const int child_leafs_end   = implicit_leafs_index(data->data, data->depth + 1, child_level_index + 1);
 
 		if (child_leafs_end - child_leafs_begin > 1) {
-			parent->children[k] = data->branches_array + child_index;
+			parent->children[k] = &data->branches_array[child_index];
 			parent->children[k]->parent = parent;
 		}
 		else if (child_leafs_end - child_leafs_begin == 1) {
@@ -879,13 +879,13 @@ static void non_recursive_bvh_div_nodes(
 	int depth;
 	
 	/* set parent from root node to NULL */
-	BVHNode *tmp = branches_array + 0;
+	BVHNode *tmp = &branches_array[0];
 	tmp->parent = NULL;
 
 	/* Most of bvhtree code relies on 1-leaf trees having at least one branch
 	 * We handle that special case here */
 	if (num_leafs == 1) {
-		BVHNode *root = branches_array + 0;
+		BVHNode *root = &branches_array[0];
 		refit_kdop_hull(tree, root, 0, num_leafs);
 		root->main_axis = get_largest_axis(root->bv) / 2;
 		root->totnode = 1;




More information about the Bf-blender-cvs mailing list