diff --git a/src/Common/src/Internal/NativeFormat/TypeHashingAlgorithms.cs b/src/Common/src/Internal/NativeFormat/TypeHashingAlgorithms.cs index 141e271bcb2..9f97cbb8e63 100644 --- a/src/Common/src/Internal/NativeFormat/TypeHashingAlgorithms.cs +++ b/src/Common/src/Internal/NativeFormat/TypeHashingAlgorithms.cs @@ -16,12 +16,6 @@ namespace Internal.NativeFormat { static class TypeHashingAlgorithms { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - // // Returns the hashcode value of the 'src' string // @@ -32,13 +26,13 @@ public static int ComputeNameHashCode(string src) for (int i = 0; i < src.Length; i += 2) { - hash1 = (hash1 + _rotl(hash1, 5)) ^ src[i]; + hash1 = (hash1 + BitOps.RotateLeft(hash1, 5)) ^ src[i]; if ((i + 1) < src.Length) - hash2 = (hash2 + _rotl(hash2, 5)) ^ src[i + 1]; + hash2 = (hash2 + BitOps.RotateLeft(hash2, 5)) ^ src[i + 1]; } - hash1 += _rotl(hash1, 8); - hash2 += _rotl(hash2, 8); + hash1 += BitOps.RotateLeft(hash1, 8); + hash2 += BitOps.RotateLeft(hash2, 8); return hash1 ^ hash2; } @@ -87,8 +81,8 @@ public static int ComputeArrayTypeHashCode(int elementTypeHashcode, int rank) hashCode = ComputeNameHashCode("System.MDArrayRank" + IntToString(rank) + "`1"); } - hashCode = (hashCode + _rotl(hashCode, 13)) ^ elementTypeHashcode; - return (hashCode + _rotl(hashCode, 15)); + hashCode = (hashCode + BitOps.RotateLeft(hashCode, 13)) ^ elementTypeHashcode; + return (hashCode + BitOps.RotateLeft(hashCode, 15)); } public static int ComputeArrayTypeHashCode(T elementType, int rank) @@ -99,7 +93,7 @@ public static int ComputeArrayTypeHashCode(T elementType, int rank) public static int ComputePointerTypeHashCode(int pointeeTypeHashcode) { - return (pointeeTypeHashcode + _rotl(pointeeTypeHashcode, 5)) ^ 0x12D0; + return (pointeeTypeHashcode + BitOps.RotateLeft(pointeeTypeHashcode, 5)) ^ 0x12D0; } public static int ComputePointerTypeHashCode(T pointeeType) @@ -110,7 +104,7 @@ public static int ComputePointerTypeHashCode(T pointeeType) public static int ComputeByrefTypeHashCode(int parameterTypeHashcode) { - return (parameterTypeHashcode + _rotl(parameterTypeHashcode, 7)) ^ 0x4C85; + return (parameterTypeHashcode + BitOps.RotateLeft(parameterTypeHashcode, 7)) ^ 0x4C85; } public static int ComputeByrefTypeHashCode(T parameterType) @@ -121,7 +115,7 @@ public static int ComputeByrefTypeHashCode(T parameterType) public static int ComputeNestedTypeHashCode(int enclosingTypeHashcode, int nestedTypeNameHash) { - return (enclosingTypeHashcode + _rotl(enclosingTypeHashcode, 11)) ^ nestedTypeNameHash; + return (enclosingTypeHashcode + BitOps.RotateLeft(enclosingTypeHashcode, 11)) ^ nestedTypeNameHash; } @@ -131,9 +125,9 @@ public static int ComputeGenericInstanceHashCode(int genericDefinitionHashC for (int i = 0; i < genericTypeArguments.Length; i++) { int argumentHashCode = genericTypeArguments[i].GetHashCode(); - hashcode = (hashcode + _rotl(hashcode, 13)) ^ argumentHashCode; + hashcode = (hashcode + BitOps.RotateLeft(hashcode, 13)) ^ argumentHashCode; } - return (hashcode + _rotl(hashcode, 15)); + return (hashcode + BitOps.RotateLeft(hashcode, 15)); } } } diff --git a/src/Common/src/Internal/Text/Utf8String.cs b/src/Common/src/Internal/Text/Utf8String.cs index 47e70135076..b81f56c062d 100644 --- a/src/Common/src/Internal/Text/Utf8String.cs +++ b/src/Common/src/Internal/Text/Utf8String.cs @@ -43,13 +43,6 @@ public override bool Equals(object obj) return (obj is Utf8String) && Equals((Utf8String)obj); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - // This is expected to be optimized into a single rotl instruction - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - public unsafe override int GetHashCode() { int length = _value.Length; @@ -60,20 +53,20 @@ public unsafe override int GetHashCode() while (length >= 4) { - hash = (hash + _rotl(hash, 5)) ^ *(int*)a; + hash = (hash + BitOps.RotateLeft(hash, 5)) ^ *(int*)a; a += 4; length -= 4; } if (length >= 2) { - hash = (hash + _rotl(hash, 5)) ^ *(short*)a; + hash = (hash + BitOps.RotateLeft(hash, 5)) ^ *(short*)a; a += 2; length -= 2; } if (length > 0) { - hash = (hash + _rotl(hash, 5)) ^ *a; + hash = (hash + BitOps.RotateLeft(hash, 5)) ^ *a; } - hash += _rotl(hash, 7); - hash += _rotl(hash, 15); + hash += BitOps.RotateLeft(hash, 7); + hash += BitOps.RotateLeft(hash, 15); return hash; } } diff --git a/src/Common/src/TypeSystem/Common/TypeHashingAlgorithms.cs b/src/Common/src/TypeSystem/Common/TypeHashingAlgorithms.cs index acd6c009649..e0aee4a4a38 100644 --- a/src/Common/src/TypeSystem/Common/TypeHashingAlgorithms.cs +++ b/src/Common/src/TypeSystem/Common/TypeHashingAlgorithms.cs @@ -38,15 +38,15 @@ public void Append(string src) int startIndex = 0; if ((_numCharactersHashed & 1) == 1) { - _hash2 = (_hash2 + _rotl(_hash2, 5)) ^ src[0]; + _hash2 = (_hash2 + BitOps.RotateLeft(_hash2, 5)) ^ src[0]; startIndex = 1; } for (int i = startIndex; i < src.Length; i += 2) { - _hash1 = (_hash1 + _rotl(_hash1, 5)) ^ src[i]; + _hash1 = (_hash1 + BitOps.RotateLeft(_hash1, 5)) ^ src[i]; if ((i + 1) < src.Length) - _hash2 = (_hash2 + _rotl(_hash2, 5)) ^ src[i + 1]; + _hash2 = (_hash2 + BitOps.RotateLeft(_hash2, 5)) ^ src[i + 1]; } _numCharactersHashed += src.Length; @@ -54,19 +54,13 @@ public void Append(string src) public int ToHashCode() { - int hash1 = _hash1 + _rotl(_hash1, 8); - int hash2 = _hash2 + _rotl(_hash2, 8); + int hash1 = _hash1 + BitOps.RotateLeft(_hash1, 8); + int hash2 = _hash2 + BitOps.RotateLeft(_hash2, 8); return hash1 ^ hash2; } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - // // Returns the hashcode value of the 'src' string // @@ -77,13 +71,13 @@ public static int ComputeNameHashCode(string src) for (int i = 0; i < src.Length; i += 2) { - hash1 = (hash1 + _rotl(hash1, 5)) ^ src[i]; + hash1 = (hash1 + BitOps.RotateLeft(hash1, 5)) ^ src[i]; if ((i + 1) < src.Length) - hash2 = (hash2 + _rotl(hash2, 5)) ^ src[i + 1]; + hash2 = (hash2 + BitOps.RotateLeft(hash2, 5)) ^ src[i + 1]; } - hash1 += _rotl(hash1, 8); - hash2 += _rotl(hash2, 8); + hash1 += BitOps.RotateLeft(hash1, 8); + hash2 += BitOps.RotateLeft(hash2, 8); return hash1 ^ hash2; } @@ -98,17 +92,17 @@ public static unsafe int ComputeASCIINameHashCode(byte* data, int length, out bo { int b1 = data[i]; asciiMask |= b1; - hash1 = (hash1 + _rotl(hash1, 5)) ^ b1; + hash1 = (hash1 + BitOps.RotateLeft(hash1, 5)) ^ b1; if ((i + 1) < length) { int b2 = data[i]; asciiMask |= b2; - hash2 = (hash2 + _rotl(hash2, 5)) ^ b2; + hash2 = (hash2 + BitOps.RotateLeft(hash2, 5)) ^ b2; } } - hash1 += _rotl(hash1, 8); - hash2 += _rotl(hash2, 8); + hash1 += BitOps.RotateLeft(hash1, 8); + hash2 += BitOps.RotateLeft(hash2, 8); isAscii = (asciiMask & 0x80) == 0; @@ -159,8 +153,8 @@ public static int ComputeArrayTypeHashCode(int elementTypeHashCode, int rank) hashCode = ComputeNameHashCode("System.MDArrayRank" + IntToString(rank) + "`1"); } - hashCode = (hashCode + _rotl(hashCode, 13)) ^ elementTypeHashCode; - return (hashCode + _rotl(hashCode, 15)); + hashCode = (hashCode + BitOps.RotateLeft(hashCode, 13)) ^ elementTypeHashCode; + return (hashCode + BitOps.RotateLeft(hashCode, 15)); } public static int ComputeArrayTypeHashCode(T elementType, int rank) @@ -171,7 +165,7 @@ public static int ComputeArrayTypeHashCode(T elementType, int rank) public static int ComputePointerTypeHashCode(int pointeeTypeHashCode) { - return (pointeeTypeHashCode + _rotl(pointeeTypeHashCode, 5)) ^ 0x12D0; + return (pointeeTypeHashCode + BitOps.RotateLeft(pointeeTypeHashCode, 5)) ^ 0x12D0; } public static int ComputePointerTypeHashCode(T pointeeType) @@ -182,7 +176,7 @@ public static int ComputePointerTypeHashCode(T pointeeType) public static int ComputeByrefTypeHashCode(int parameterTypeHashCode) { - return (parameterTypeHashCode + _rotl(parameterTypeHashCode, 7)) ^ 0x4C85; + return (parameterTypeHashCode + BitOps.RotateLeft(parameterTypeHashCode, 7)) ^ 0x4C85; } public static int ComputeByrefTypeHashCode(T parameterType) @@ -193,7 +187,7 @@ public static int ComputeByrefTypeHashCode(T parameterType) public static int ComputeNestedTypeHashCode(int enclosingTypeHashCode, int nestedTypeNameHash) { - return (enclosingTypeHashCode + _rotl(enclosingTypeHashCode, 11)) ^ nestedTypeNameHash; + return (enclosingTypeHashCode + BitOps.RotateLeft(enclosingTypeHashCode, 11)) ^ nestedTypeNameHash; } @@ -203,9 +197,9 @@ public static int ComputeGenericInstanceHashCode(int genericDefinitionHashC for (int i = 0; i < genericTypeArguments.Length; i++) { int argumentHashCode = genericTypeArguments[i].GetHashCode(); - hashcode = (hashcode + _rotl(hashcode, 13)) ^ argumentHashCode; + hashcode = (hashcode + BitOps.RotateLeft(hashcode, 13)) ^ argumentHashCode; } - return (hashcode + _rotl(hashcode, 15)); + return (hashcode + BitOps.RotateLeft(hashcode, 15)); } public static int ComputeMethodSignatureHashCode(int returnTypeHashCode, ARG[] parameters) @@ -217,9 +211,9 @@ public static int ComputeMethodSignatureHashCode(int returnTypeHashCode, AR for (int i = 0; i < parameters.Length; i++) { int parameterHashCode = parameters[i].GetHashCode(); - hashcode = (hashcode + _rotl(hashcode, 13)) ^ parameterHashCode; + hashcode = (hashcode + BitOps.RotateLeft(hashcode, 13)) ^ parameterHashCode; } - return (hashcode + _rotl(hashcode, 15)); + return (hashcode + BitOps.RotateLeft(hashcode, 15)); } /// diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs index 5392ad1cde5..a2bb0089d9c 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs @@ -341,20 +341,13 @@ public bool Equals(VertexSequenceKey other) return true; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - // This is expected to be optimized into a single rotl instruction - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - public override int GetHashCode() { int hashcode = 0; foreach (NativeLayoutVertexNode node in Vertices) { hashcode ^= node.GetHashCode(); - hashcode = _rotl(hashcode, 5); + hashcode = BitOps.RotateLeft(hashcode, 5); } return hashcode; } @@ -381,20 +374,13 @@ bool IEqualityComparer>.Equals(List x, List y) return true; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - // This is expected to be optimized into a single rotl instruction - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - int IEqualityComparer>.GetHashCode(List obj) { int hashcode = 0x42284781; foreach (uint u in obj) { hashcode ^= (int)u; - hashcode = _rotl(hashcode, 5); + hashcode = BitOps.RotateLeft(hashcode, 5); } return hashcode; diff --git a/src/ILCompiler.ReadyToRun/src/Compiler/ReadyToRunHashCode.cs b/src/ILCompiler.ReadyToRun/src/Compiler/ReadyToRunHashCode.cs index b6d7e23418e..24aca1e2300 100644 --- a/src/ILCompiler.ReadyToRun/src/Compiler/ReadyToRunHashCode.cs +++ b/src/ILCompiler.ReadyToRun/src/Compiler/ReadyToRunHashCode.cs @@ -34,10 +34,10 @@ public static int NameHashCode(string name) byte[] src = Encoding.UTF8.GetBytes(name); for (int i = 0; i < src.Length; i += 2) { - hash1 = unchecked(hash1 + RotateLeft(hash1, 5)) ^ src[i]; + hash1 = unchecked(hash1 + BitOps.RotateLeft(hash1, 5)) ^ src[i]; if (i + 1 < src.Length) { - hash2 = unchecked(hash2 + RotateLeft(hash2, 5)) ^ src[i + 1]; + hash2 = unchecked(hash2 + BitOps.RotateLeft(hash2, 5)) ^ src[i + 1]; } else { @@ -45,8 +45,8 @@ public static int NameHashCode(string name) } } - hash1 = unchecked(hash1 + RotateLeft(hash1, 8)); - hash2 = unchecked(hash2 + RotateLeft(hash2, 8)); + hash1 = unchecked(hash1 + BitOps.RotateLeft(hash1, 8)); + hash2 = unchecked(hash2 + BitOps.RotateLeft(hash2, 8)); return unchecked((int)(hash1 ^ hash2)); } @@ -130,7 +130,7 @@ public static int TypeHashCode(TypeDesc type) /// Hash code of the nested type name private static int NestedTypeHashCode(int enclosingTypeHashcode, int nestedTypeNameHash) { - return unchecked(enclosingTypeHashcode + RotateLeft(enclosingTypeHashcode, 11)) ^ nestedTypeNameHash; + return unchecked(enclosingTypeHashcode + BitOps.RotateLeft(enclosingTypeHashcode, 11)) ^ nestedTypeNameHash; } /// @@ -147,8 +147,8 @@ private static int ArrayTypeHashCode(int elementTypeHashcode, int rank) { Debug.Assert(hashCode == NameHashCode("System.Array`1")); } - hashCode = unchecked(hashCode + RotateLeft(hashCode, 13)) ^ elementTypeHashcode; - return unchecked(hashCode + RotateLeft(hashCode, 15)); + hashCode = unchecked(hashCode + BitOps.RotateLeft(hashCode, 13)) ^ elementTypeHashcode; + return unchecked(hashCode + BitOps.RotateLeft(hashCode, 15)); } /// @@ -157,7 +157,7 @@ private static int ArrayTypeHashCode(int elementTypeHashcode, int rank) /// Hash code of the pointee type private static int PointerTypeHashCode(int pointeeTypeHashcode) { - return unchecked(pointeeTypeHashcode + RotateLeft(pointeeTypeHashcode, 5)) ^ 0x12D0; + return unchecked(pointeeTypeHashcode + BitOps.RotateLeft(pointeeTypeHashcode, 5)) ^ 0x12D0; } /// @@ -166,7 +166,7 @@ private static int PointerTypeHashCode(int pointeeTypeHashcode) /// Hash code representing the parameter type private static int ByrefTypeHashCode(int parameterTypeHashcode) { - return unchecked(parameterTypeHashcode + RotateLeft(parameterTypeHashcode, 7)) ^ 0x4C85; + return unchecked(parameterTypeHashcode + BitOps.RotateLeft(parameterTypeHashcode, 7)) ^ 0x4C85; } /// @@ -179,9 +179,9 @@ private static int GenericInstanceHashCode(int hashcode, Instantiation instantia for (int i = 0; i < instantiation.Length; i++) { int argumentHashCode = TypeHashCode(instantiation[i]); - hashcode = unchecked(hashcode + RotateLeft(hashcode, 13)) ^ argumentHashCode; + hashcode = unchecked(hashcode + BitOps.RotateLeft(hashcode, 13)) ^ argumentHashCode; } - return unchecked(hashcode + RotateLeft(hashcode, 15)); + return unchecked(hashcode + BitOps.RotateLeft(hashcode, 15)); } /// @@ -205,15 +205,5 @@ public static int MethodHashCode(MethodDesc method) return hashCode; } - - /// - /// Bitwise left 32-bit rotation with wraparound. - /// - /// Value to rotate - /// Number of bits - private static int RotateLeft(int value, int bitCount) - { - return unchecked((int)(((uint)value << bitCount) | ((uint)value >> (32 - bitCount)))); - } } } diff --git a/src/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs b/src/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs index d207d7ea2c1..3e3933ad02c 100644 --- a/src/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs +++ b/src/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs @@ -174,12 +174,6 @@ unsafe public static IntPtr ResolveMethod(IntPtr resolver, object thisObject) return TypeLoaderExports.OpenInstanceMethodLookup(resolver, thisObject); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - private static int CalcHashCode(int hashCode1, int hashCode2, int hashCode3, int hashCode4) { int length = 4; @@ -187,13 +181,13 @@ private static int CalcHashCode(int hashCode1, int hashCode2, int hashCode3, int int hash1 = 0x449b3ad6; int hash2 = (length << 3) + 0x55399219; - hash1 = (hash1 + _rotl(hash1, 5)) ^ hashCode1; - hash2 = (hash2 + _rotl(hash2, 5)) ^ hashCode2; - hash1 = (hash1 + _rotl(hash1, 5)) ^ hashCode3; - hash2 = (hash2 + _rotl(hash2, 5)) ^ hashCode4; + hash1 = (hash1 + BitOps.RotateLeft(hash1, 5)) ^ hashCode1; + hash2 = (hash2 + BitOps.RotateLeft(hash2, 5)) ^ hashCode2; + hash1 = (hash1 + BitOps.RotateLeft(hash1, 5)) ^ hashCode3; + hash2 = (hash2 + BitOps.RotateLeft(hash2, 5)) ^ hashCode4; - hash1 += _rotl(hash1, 8); - hash2 += _rotl(hash2, 8); + hash1 += BitOps.RotateLeft(hash1, 8); + hash2 += BitOps.RotateLeft(hash2, 8); return hash1 ^ hash2; } diff --git a/src/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs b/src/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs index 3e9b5a5e2ec..56505b4fe00 100644 --- a/src/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs +++ b/src/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs @@ -43,12 +43,6 @@ public bool Equals(RuntimeFieldHandle handle) return declaringType1.Equals(declaringType2) && fieldName1 == fieldName2; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int _rotl(int value, int shift) - { - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - public override int GetHashCode() { if (_value == IntPtr.Zero) @@ -59,7 +53,7 @@ public override int GetHashCode() RuntimeAugments.TypeLoaderCallbacks.GetRuntimeFieldHandleComponents(this, out declaringType, out fieldName); int hashcode = declaringType.GetHashCode(); - return (hashcode + _rotl(hashcode, 13)) ^ fieldName.GetHashCode(); + return (hashcode + BitOps.RotateLeft(hashcode, 13)) ^ fieldName.GetHashCode(); } public static bool operator ==(RuntimeFieldHandle left, RuntimeFieldHandle right) diff --git a/src/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs b/src/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs index 02d1b8da082..ab153f615d0 100644 --- a/src/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs +++ b/src/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs @@ -63,12 +63,6 @@ public bool Equals(RuntimeMethodHandle handle) return true; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int _rotl(int value, int shift) - { - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - public override int GetHashCode() { if (_value == IntPtr.Zero) @@ -80,13 +74,13 @@ public override int GetHashCode() RuntimeAugments.TypeLoaderCallbacks.GetRuntimeMethodHandleComponents(this, out declaringType, out nameAndSignature, out genericArgs); int hashcode = declaringType.GetHashCode(); - hashcode = (hashcode + _rotl(hashcode, 13)) ^ nameAndSignature.Name.GetHashCode(); + hashcode = (hashcode + BitOps.RotateLeft(hashcode, 13)) ^ nameAndSignature.Name.GetHashCode(); if (genericArgs != null) { for (int i = 0; i < genericArgs.Length; i++) { int argumentHashCode = genericArgs[i].GetHashCode(); - hashcode = (hashcode + _rotl(hashcode, 13)) ^ argumentHashCode; + hashcode = (hashcode + BitOps.RotateLeft(hashcode, 13)) ^ argumentHashCode; } } diff --git a/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs b/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs index 083a384f7f0..5bdbf33c4c1 100644 --- a/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs +++ b/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs @@ -117,15 +117,9 @@ protected override NamedTypeLookupResult CreateValueFromKey(RuntimeTypeHandle ke private class QTypeDefinitionToRuntimeTypeHandleHashtable : LockFreeReaderHashtable { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int _rotl(int value, int shift) - { - return (int)(((uint)value << shift) | ((uint)value >> (32 - shift))); - } - protected unsafe override int GetKeyHashCode(QTypeDefinition key) { - return key.Token.GetHashCode() ^ _rotl(key.Reader.GetHashCode(), 8); + return key.Token.GetHashCode() ^ BitOps.RotateLeft(key.Reader.GetHashCode(), 8); } protected override bool CompareKeyToValue(QTypeDefinition key, NamedTypeLookupResult value) { @@ -135,7 +129,7 @@ protected override bool CompareKeyToValue(QTypeDefinition key, NamedTypeLookupRe protected unsafe override int GetValueHashCode(NamedTypeLookupResult value) { - return value.QualifiedTypeDefinition.Token.GetHashCode() ^ _rotl(value.QualifiedTypeDefinition.Reader.GetHashCode(), 8); + return value.QualifiedTypeDefinition.Token.GetHashCode() ^ BitOps.RotateLeft(value.QualifiedTypeDefinition.Reader.GetHashCode(), 8); } protected override bool CompareValueToValue(NamedTypeLookupResult value1, NamedTypeLookupResult value2)