diff options
author | Weiyi Wang <wwylele@gmail.com> | 2017-09-25 02:37:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 02:37:14 +0200 |
commit | a81536f53fb5adbae6556711893698a40a578ef0 (patch) | |
tree | db271240137bfa4d2d3912a00469fbba32932af6 | |
parent | Merge pull request #2921 from jroweboy/batch-fix-2 (diff) | |
parent | Optimized Float<M,E> multiplication (diff) | |
download | yuzu-a81536f53fb5adbae6556711893698a40a578ef0.tar yuzu-a81536f53fb5adbae6556711893698a40a578ef0.tar.gz yuzu-a81536f53fb5adbae6556711893698a40a578ef0.tar.bz2 yuzu-a81536f53fb5adbae6556711893698a40a578ef0.tar.lz yuzu-a81536f53fb5adbae6556711893698a40a578ef0.tar.xz yuzu-a81536f53fb5adbae6556711893698a40a578ef0.tar.zst yuzu-a81536f53fb5adbae6556711893698a40a578ef0.zip |
-rw-r--r-- | src/video_core/pica_types.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/video_core/pica_types.h b/src/video_core/pica_types.h index 5d7e10066..2eafa7e9e 100644 --- a/src/video_core/pica_types.h +++ b/src/video_core/pica_types.h @@ -58,11 +58,12 @@ public: } Float<M, E> operator*(const Float<M, E>& flt) const { - if ((this->value == 0.f && !std::isnan(flt.value)) || - (flt.value == 0.f && !std::isnan(this->value))) - // PICA gives 0 instead of NaN when multiplying by inf - return Zero(); - return Float<M, E>::FromFloat32(ToFloat32() * flt.ToFloat32()); + 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)) + result = 0.f; + return Float<M, E>::FromFloat32(result); } Float<M, E> operator/(const Float<M, E>& flt) const { @@ -78,12 +79,7 @@ public: } Float<M, E>& operator*=(const Float<M, E>& flt) { - if ((this->value == 0.f && !std::isnan(flt.value)) || - (flt.value == 0.f && !std::isnan(this->value))) - // PICA gives 0 instead of NaN when multiplying by inf - *this = Zero(); - else - value *= flt.ToFloat32(); + value = operator*(flt).value; return *this; } |