From e150de0d229401b045bf17cd5a1b658f69b2230c Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Wed, 21 Dec 2011 11:30:29 -0500 Subject: Use the sincosf() function when computing both the sin() and cos() of the same angle for greater efficiency. --- chroma/cuda/photon.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chroma/cuda/photon.h b/chroma/cuda/photon.h index 371c122..ff2868a 100644 --- a/chroma/cuda/photon.h +++ b/chroma/cuda/photon.h @@ -127,10 +127,10 @@ __device__ float3 pick_new_direction(float3 axis, float theta, float phi) { // Taken from SNOMAN rayscatter.for - float cos_theta = cosf(theta); - float sin_theta = sinf(theta); - float cos_phi = cosf(phi); - float sin_phi = sinf(phi); + float cos_theta, sin_theta; + sincosf(theta, &sin_theta, &cos_theta); + float cos_phi, sin_phi; + sincosf(phi, &sin_phi, &cos_phi); float sin_axis_theta = sqrt(1.0f - axis.z*axis.z); float cos_axis_phi, sin_axis_phi; -- cgit