mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
621 B
23 lines
621 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace SixLabors
|
|
{
|
|
// lifted from coreFX repo
|
|
internal static class HashHelpers
|
|
{
|
|
public static readonly int RandomSeed = Guid.NewGuid().GetHashCode();
|
|
|
|
public static int Combine(int h1, int h2)
|
|
{
|
|
unchecked
|
|
{
|
|
// 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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|