From b3641516fb858dc003eb47095f8ae25fd352b4e0 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 16 Nov 2011 17:26:22 -0500 Subject: Add some branch instrumentation from gcov profile. --- libdimension/sphere.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libdimension/sphere.c') 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; -- cgit v1.2.3