From 1c2750d5bd40a5efe32020bc598575585801f175 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 3 Dec 2017 23:39:30 +0000 Subject: [PATCH] video_core: optimize NaN check --- src/video_core/pica_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_core/pica_types.h b/src/video_core/pica_types.h index 2eafa7e9e..947e27e2e 100644 --- a/src/video_core/pica_types.h +++ b/src/video_core/pica_types.h @@ -60,8 +60,8 @@ public: Float operator*(const Float& flt) const { float result = value * flt.ToFloat32(); // 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; return Float::FromFloat32(result); }