Merge pull request #3193 from Tilka/nan_check

video_core: optimize NaN check
This commit is contained in:
Sebastian Valle 2017-12-05 19:08:58 -05:00 committed by GitHub
commit 4835342032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,8 +60,8 @@ public:
Float<M, E> operator*(const Float<M, E>& flt) const { Float<M, E> operator*(const Float<M, E>& flt) const {
float result = value * flt.ToFloat32(); float result = value * flt.ToFloat32();
// PICA gives 0 instead of NaN when multiplying by inf // PICA gives 0 instead of NaN when multiplying by inf
if (!std::isnan(value) && !std::isnan(flt.ToFloat32()))
if (std::isnan(result)) if (std::isnan(result))
if (!std::isnan(value) && !std::isnan(flt.ToFloat32()))
result = 0.f; result = 0.f;
return Float<M, E>::FromFloat32(result); return Float<M, E>::FromFloat32(result);
} }