1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 namespace System.Numerics.Hashing
6 {
7     // Please change the corresponding file in corefx if this is changed.
8 
9     internal static class HashHelpers
10     {
11         public static readonly int RandomSeed = new Random().Next(Int32.MinValue, Int32.MaxValue);
12 
Combine(int h1, int h2)13         public static int Combine(int h1, int h2)
14         {
15             // RyuJIT optimizes this to use the ROL instruction
16             // Related GitHub pull request: dotnet/coreclr#1830
17             uint rol5 = ((uint)h1 << 5) | ((uint)h1 >> 27);
18             return ((int)rol5 + h1) ^ h2;
19         }
20     }
21 }
22