From: Huo Yaoyuan Date: Mon, 31 Aug 2020 07:08:21 +0000 (+0800) Subject: Optimize Half.Equals (#41554) X-Git-Tag: submit/tizen/20210909.063632~5702 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b771749f6590837e15d9a9e3c209a32d731e513;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Optimize Half.Equals (#41554) --- diff --git a/src/libraries/System.Private.CoreLib/src/System/Half.cs b/src/libraries/System.Private.CoreLib/src/System/Half.cs index 1840f3c..98852c4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Half.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Half.cs @@ -422,11 +422,9 @@ namespace System /// public bool Equals(Half other) { - if (this == other) - { - return true; - } - return IsNaN(this) && IsNaN(other); + return _value == other._value + || AreZero(this, other) + || (IsNaN(this) && IsNaN(other)); } ///