diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-06-27 14:25:07 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2014-06-27 14:25:07 -0400 |
commit | 87e95a688130cd4059a5e3edd8885441a16eeaf6 (patch) | |
tree | ad0be724503e9c6d3159a6e62fe5885e10b99d03 /libdimension | |
parent | 00397179fc5d948c53bb3201c56cbc02f5677ac6 (diff) | |
download | dimension-87e95a688130cd4059a5e3edd8885441a16eeaf6.tar.xz |
prtree: Small cleanups.
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/prtree.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libdimension/prtree.c b/libdimension/prtree.c index 65eb6fa..c525988 100644 --- a/libdimension/prtree.c +++ b/libdimension/prtree.c @@ -152,7 +152,7 @@ dmnsn_add_priority_leaves(dmnsn_bvh_node **sorted_leaves[DMNSN_PSEUDO_B], /// Get rid of the extreme nodes. static void -dmnsn_filter_leaves(dmnsn_bvh_node **leaves, size_t start, size_t *endp) +dmnsn_filter_priority_leaves(dmnsn_bvh_node **leaves, size_t start, size_t *endp) { size_t i, skip, end; for (i = start, skip = 0, end = *endp; i < end; ++i) { @@ -183,7 +183,7 @@ dmnsn_split_sorted_leaves_easy(dmnsn_bvh_node **leaves, size_t start, size_t *mi /// Split the leaves using the coloring from dmnsn_split_sorted_leaves_easy(). static void -dmnsn_split_sorted_leaves_hard(dmnsn_bvh_node **leaves, dmnsn_bvh_node **buffer, size_t start, size_t mid, size_t end) +dmnsn_split_sorted_leaves_hard(dmnsn_bvh_node **leaves, dmnsn_bvh_node **buffer, size_t start, size_t end) { size_t i, j, skip; for (i = start, j = 0, skip = 0; i < end; ++i) { @@ -198,6 +198,7 @@ dmnsn_split_sorted_leaves_hard(dmnsn_bvh_node **leaves, dmnsn_bvh_node **buffer, } } + size_t mid = i - skip; for (i = 0; i < j; ++i) { leaves[mid + i] = buffer[i]; } @@ -212,7 +213,7 @@ dmnsn_split_sorted_leaves(dmnsn_bvh_node **sorted_leaves[DMNSN_PSEUDO_B], size_t orig_end = *endp; // Filter the extreme nodes in the ith list - dmnsn_filter_leaves(sorted_leaves[i], start, endp); + dmnsn_filter_priority_leaves(sorted_leaves[i], start, endp); // Split the ith list dmnsn_split_sorted_leaves_easy(sorted_leaves[i], start, midp, *endp); @@ -223,7 +224,7 @@ dmnsn_split_sorted_leaves(dmnsn_bvh_node **sorted_leaves[DMNSN_PSEUDO_B], continue; } - dmnsn_split_sorted_leaves_hard(sorted_leaves[j], buffer, start, *midp, orig_end); + dmnsn_split_sorted_leaves_hard(sorted_leaves[j], buffer, start, orig_end); } } |