using System.Collections.Generic;
#if ES_BUILD_STANDALONE
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
private static System.Resources.ResourceManager rm = new System.Resources.ResourceManager("Microsoft.Diagnostics.Tracing.Messages", typeof(Environment).Assembly());
}
+
+#if ES_BUILD_STANDALONE
+ internal static class BitOps
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static uint RotateLeft(uint value, int offset)
+ => (value << offset) | (value >> (32 - offset));
+ }
+#endif
}
#if ES_BUILD_AGAINST_DOTNET_V35
public static int Combine(int h1, int h2)
{
- return ((int)BitOps.RotateLeft((uint)h1, 5) + h1) ^ h2;
+ // RyuJIT optimizes this to use the ROL instruction
+ // Related GitHub pull request: dotnet/coreclr#1830
+ uint rol5 = ((uint)h1 << 5) | ((uint)h1 >> 27);
+ return ((int)rol5 + h1) ^ h2;
}
}
}