Cleanup: use index syntax instead of addition

Harmless but made accessing the first element read strangely.
This commit is contained in:
Campbell Barton 2017-05-07 03:12:39 +10:00
parent ce31a892db
commit bca6978347
Notes: blender-bot 2023-02-14 07:00:18 +01:00
Referenced by issue #51442, Compiling OpenCL program base: CL_DEVICE_NOT_AVAILABLE
Referenced by issue #51429, Blender SEGFAULT on Intel HW and DWM.
Referenced by issue #51431, freestyle svg exporter doesn't load anymore
1 changed files with 4 additions and 4 deletions

View File

@ -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;