From: ichensky Date: Sun, 23 Dec 2018 12:47:25 +0000 (+0200) Subject: Add optimization in GetHashCode for Int16 and SByte (#21652) X-Git-Tag: accepted/tizen/unified/20190422.045933~285 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4cab6e31898098d17e3e9b2e44a0f88b6db43ec;p=platform%2Fupstream%2Fcoreclr.git Add optimization in GetHashCode for Int16 and SByte (#21652) --- diff --git a/src/System.Private.CoreLib/shared/System/Int16.cs b/src/System.Private.CoreLib/shared/System/Int16.cs index bb5a91b..37e1639 100644 --- a/src/System.Private.CoreLib/shared/System/Int16.cs +++ b/src/System.Private.CoreLib/shared/System/Int16.cs @@ -63,7 +63,7 @@ namespace System // Returns a HashCode for the Int16 public override int GetHashCode() { - return ((int)((ushort)m_value) | (((int)m_value) << 16)); + return m_value; } diff --git a/src/System.Private.CoreLib/shared/System/SByte.cs b/src/System.Private.CoreLib/shared/System/SByte.cs index c3bc386..0ebe882 100644 --- a/src/System.Private.CoreLib/shared/System/SByte.cs +++ b/src/System.Private.CoreLib/shared/System/SByte.cs @@ -66,7 +66,7 @@ namespace System // Gets a hash code for this instance. public override int GetHashCode() { - return ((int)m_value ^ (int)m_value << 8); + return m_value; }