Commit 7a7055b3 authored by peastman's avatar peastman
Browse files

Merge pull request #328 from peastman/master

Fixed an intermittent segfault
parents 382b98af e49231b4
...@@ -404,10 +404,10 @@ void CpuGBSAOBCForce::getDeltaR(const fvec4& posI, const fvec4& x, const fvec4& ...@@ -404,10 +404,10 @@ void CpuGBSAOBCForce::getDeltaR(const fvec4& posI, const fvec4& x, const fvec4&
fvec4 CpuGBSAOBCForce::fastLog(const fvec4& x) { fvec4 CpuGBSAOBCForce::fastLog(const fvec4& x) {
// Evaluate log(x) using a lookup table for speed. // Evaluate log(x) using a lookup table for speed.
if (any((x < TABLE_MIN) | (x >= TABLE_MAX)))
return fvec4(logf(x[0]), logf(x[1]), logf(x[2]), logf(x[3]));
fvec4 x1 = (x-TABLE_MIN)*logDXInv; fvec4 x1 = (x-TABLE_MIN)*logDXInv;
ivec4 index = floor(x1); ivec4 index = floor(x1);
if (any((index < 0) | (index >= NUM_TABLE_POINTS)))
return fvec4(logf(x[0]), logf(x[1]), logf(x[2]), logf(x[3]));
fvec4 coeff2 = x1-index; fvec4 coeff2 = x1-index;
fvec4 coeff1 = 1.0f-coeff2; fvec4 coeff1 = 1.0f-coeff2;
fvec4 t1(&logTable[index[0]]); fvec4 t1(&logTable[index[0]]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment