Pārlūkot izejas kodu

Add optimization in GetHashCode for Int16 and SByte (dotnet/coreclr#21652)

Signed-off-by: dotnet-bot <[email protected]>
ichensky 7 gadi atpakaļ
vecāks
revīzija
92c2fab68e

+ 1 - 1
netcore/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;
         }
 
 

+ 1 - 1
netcore/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;
         }