summaryrefslogtreecommitdiffstats
path: root/libdimension/sphere.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-11-16 17:26:22 -0500
committerTavian Barnes <tavianator@gmail.com>2011-11-16 17:26:22 -0500
commitb3641516fb858dc003eb47095f8ae25fd352b4e0 (patch)
tree6640dfb1ed1c0d4fad3fc894fabee19225a7140f /libdimension/sphere.c
parent78dca8153f802f271b4f2aeca33d967a075e485e (diff)
downloaddimension-b3641516fb858dc003eb47095f8ae25fd352b4e0.tar.xz
Add some branch instrumentation from gcov profile.
Diffstat (limited to 'libdimension/sphere.c')
-rw-r--r--libdimension/sphere.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libdimension/sphere.c b/libdimension/sphere.c
index a3f0c90..96bc617 100644
--- a/libdimension/sphere.c
+++ b/libdimension/sphere.c
@@ -23,7 +23,7 @@
* Spheres.
*/
-#include "dimension.h"
+#include "dimension-internal.h"
/** Sphere intersection callback. */
static bool
@@ -41,7 +41,8 @@ dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line l,
return false;
} else {
double t = x[0];
- if (n == 2)
+ /* Optimize for the case where we're outside the sphere */
+ if (dmnsn_likely(n == 2))
t = dmnsn_min(t, x[1]);
intersection->t = t;