Skip to content

Commit

Permalink
GPU: Do not use FastInvSqrt with GPUCA_NO_FAST_MATH
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrohr committed Feb 16, 2024
1 parent 255082a commit 2ed0a63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GPU/Common/GPUCommonMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ GPUdi() T GPUCommonMath::MaxWithRef(T x, T y, T z, T w, S refX, S refY, S refZ,

GPUdi() float GPUCommonMath::FastInvSqrt(float _x)
{
#ifdef GPUCA_NO_FAST_MATH
return 1.f / Sqrt(_x);
#else
// the function calculates fast inverse sqrt
union {
float f;
Expand All @@ -400,6 +403,7 @@ GPUdi() float GPUCommonMath::FastInvSqrt(float _x)
x.i = 0x5f3759df - (x.i >> 1);
x.f = x.f * (1.5f - xhalf * x.f * x.f);
return x.f;
#endif
}

template <>
Expand Down

0 comments on commit 2ed0a63

Please sign in to comment.