]> git.itanic.dy.fi Git - sdl-planets/commitdiff
quadtree: Macros with complex values should be enclosed in parenthesis
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Tue, 12 Jul 2011 16:42:35 +0000 (19:42 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Tue, 12 Jul 2011 16:42:35 +0000 (19:42 +0300)
This makes macro usage more reliable

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
quadtree.c

index e35505dffb9c1de3c827cc9fc4fe5f10114f605d..827384aae129ce5fa8f97f4d40771dd90629535a 100644 (file)
@@ -195,10 +195,10 @@ static void _recalculate_node_area_stats(struct quadtree *node)
                 * points needs be as wide as its widest child node's
                 * corners.
                 */
-#define CHILD_CORNER_SAFE(node, ch_idx, cor_idx, axis)              \
-               (node)->child[ch_idx] ?                              \
-                       (node)->child[ch_idx]->corner[cor_idx].axis : \
-                       (node)->pos.axis
+#define CHILD_CORNER_SAFE(node, ch_idx, cor_idx, axis)         \
+       ((node)->child[ch_idx] ?                                \
+               (node)->child[ch_idx]->corner[cor_idx].axis :   \
+               (node)->pos.axis)
 
                node->corner[0].x = MIN(CHILD_CORNER_SAFE(node, 0, 0, x),
                                        CHILD_CORNER_SAFE(node, 2, 0, x));