diff options
Diffstat (limited to 'src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs')
-rw-r--r-- | src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs b/src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs index 0314d1af3c..f017309a90 100644 --- a/src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs +++ b/src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs @@ -8,12 +8,14 @@ namespace System.Numerics.Hashing internal static class HashHelpers { + public static readonly int RandomSeed = new Random().Next(Int32.MinValue, Int32.MaxValue); + public static int Combine(int h1, int h2) { - // The jit optimizes this to use the ROL instruction on x86 + // RyuJIT optimizes this to use the ROL instruction // Related GitHub pull request: dotnet/coreclr#1830 - uint shift5 = ((uint)h1 << 5) | ((uint)h1 >> 27); - return ((int)shift5 + h1) ^ h2; + uint rol5 = ((uint)h1 << 5) | ((uint)h1 >> 27); + return ((int)rol5 + h1) ^ h2; } } } |