Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
92f155c
Use BitOperations.Log2 in EETypeBuilderHelpers
PaulusParssinen Apr 29, 2024
741fd54
Use BitOperations.LeadingZeroCount in NativeFormatWriter
PaulusParssinen Apr 29, 2024
d10a145
Clarify operator precedence
PaulusParssinen Apr 29, 2024
92b2395
Merge branch 'dotnet:main' into use-bitoperations-more
PaulusParssinen May 6, 2024
1eed107
It's doing LZCNT, not Log2..
PaulusParssinen May 9, 2024
102d4b3
Merge branch 'main' into use-bitoperations-more
PaulusParssinen May 9, 2024
c14d86e
I'm blind
PaulusParssinen May 10, 2024
c423d1f
LZCNT -> TZCNT..
PaulusParssinen May 10, 2024
db3eec9
Use BitOperations.RotateLeft in NodeFactory.NativeLayout.cs
PaulusParssinen May 11, 2024
3e7de82
Add required cast
PaulusParssinen May 11, 2024
ba86069
Replace one more rotate with BitOperations in NativeLayout
PaulusParssinen May 11, 2024
447c5b2
Merge branch 'main' into use-bitoperations-more
PaulusParssinen May 13, 2024
1bcc371
Merge branch 'dotnet:main' into use-bitoperations-more
PaulusParssinen May 17, 2024
a85a69b
Use BitOperations.RotateLeft in the NAOT/CoreLib OpenMethodResolver.cs
PaulusParssinen May 17, 2024
d7b9767
Use BitOperations.RotateLeft in the NAOT/CoreLib RuntimeFieldHandle.cs
PaulusParssinen May 17, 2024
efcae80
Use BitOperations.RotateLeft in the NAOT/CoreLib RuntimeMethodHandle.cs
PaulusParssinen May 17, 2024
27ddd40
Use BitOperations.RotateLeft in the shared TypeHashingAlgorithms.cs
PaulusParssinen May 17, 2024
50ee219
Use nuint overload of BitOperations.RotateLeft in the shared CoreLib …
PaulusParssinen May 17, 2024
6049c07
Make ILVerification target NetCoreAppToolCurrent
PaulusParssinen May 17, 2024
e985569
Apply PR feedback
PaulusParssinen May 17, 2024
8c104e0
Revert TypeHashingAlgorithms.cs
PaulusParssinen May 18, 2024
0d05e17
Revert "Make ILVerification target NetCoreAppToolCurrent"
PaulusParssinen May 18, 2024
a3bb921
Merge branch 'dotnet:main' into use-bitoperations-more
PaulusParssinen May 18, 2024
1f7a788
Merge branch 'dotnet:main' into use-bitoperations-more
PaulusParssinen May 23, 2024
b49a450
Merge branch 'dotnet:main' into use-bitoperations-more
PaulusParssinen May 30, 2024
406b903
Merge branch 'dotnet:main' into use-bitoperations-more
PaulusParssinen Jun 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use BitOperations.RotateLeft in the NAOT/CoreLib RuntimeMethodHandle.cs
  • Loading branch information
PaulusParssinen committed May 17, 2024
commit efcae8099c8bd1f98d7b5bb681edc96c3ec7793d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -68,12 +69,6 @@ public bool Equals(RuntimeMethodHandle handle)
return true;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int _rotl(int value, int shift)
{
return (int)(((uint)value << shift) | ((uint)value >> (32 - shift)));
}

public override int GetHashCode()
{
if (_value == IntPtr.Zero)
Expand All @@ -85,13 +80,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 + (int)BitOperations.RotateLeft((uint)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 + (int)BitOperations.RotateLeft((uint)hashcode, 13)) ^ argumentHashCode;
}
}

Expand Down