summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-11-04 23:48:43 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-11-04 23:48:43 -0700
commitc94352a1313aa606fc38c0ed7f6c9dc1c698c62b (patch)
tree8d735c8c272699fafe11e481294499b99dfaf0b0
parent232614922b67edd42263f554183510c7407fc2c2 (diff)
libix2: fix depth maintenance precedence
*depth-- should be (*depth)-- etc. surprisingly this went unnoticed for some time but I haven't really been using libix[23] in anything other than sars which didn't get much play/testing etc. But a quick ASAN run immediately uncovered this one.
-rw-r--r--src/ix2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ix2.c b/src/ix2.c
index e87cf2c..da02f07 100644
--- a/src/ix2.c
+++ b/src/ix2.c
@@ -368,7 +368,7 @@ static ix2_object_t * add_object(ix2_t *ix2, unsigned *depth, ix2_node_t *node,
bb2f_t quadrants[4];
int i;
- *depth++;
+ (*depth)++;
init_quadrants(quadrants, node_aabb, &node->center);
for (i = 0; i < 4; i++) {
if (!aabb_overlap(NULL, NULL, &quadrants[i], &object->position, &object->origin, &object->aabb))
@@ -377,7 +377,7 @@ static ix2_object_t * add_object(ix2_t *ix2, unsigned *depth, ix2_node_t *node,
if (!add_object(ix2, depth, &node->children[i], &quadrants[i], object, reference_cache))
goto _fail;
}
- *depth--;
+ (*depth)--;
return object;
}
@@ -388,10 +388,10 @@ static ix2_object_t * add_object(ix2_t *ix2, unsigned *depth, ix2_node_t *node,
/* If the node is overflowing, split it */
if (node->n_objects > ix2->max_per_node && *depth < ix2->max_depth) {
- *depth++;
+ (*depth)++;
if (!split_node(ix2, depth, node, node_aabb))
goto _fail;
- *depth--;
+ (*depth)--;
}
return object;
© All Rights Reserved