本文整理汇总了C#中System.UInt64.RotateLeft方法的典型用法代码示例。如果您正苦于以下问题:C# UInt64.RotateLeft方法的具体用法?C# UInt64.RotateLeft怎么用?C# UInt64.RotateLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.UInt64
的用法示例。
在下文中一共展示了UInt64.RotateLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostProcess
private static void PostProcess(ref UInt64 h, UInt64[] initValues, int dataCount, byte[] remainder)
{
if (dataCount >= 32)
{
h = initValues[0].RotateLeft(1) +
initValues[1].RotateLeft(7) +
initValues[2].RotateLeft(12) +
initValues[3].RotateLeft(18);
for (var x = 0; x < initValues.Length; ++x)
{
initValues[x] *= _primes64[1];
initValues[x] = initValues[x].RotateLeft(31);
initValues[x] *= _primes64[0];
h ^= initValues[x];
h = (h * _primes64[0]) + _primes64[3];
}
}
h += (UInt64) dataCount;
if (remainder != null)
{
// In 8-byte chunks, process all full chunks
for (int x = 0; x < remainder.Length / 8; ++x)
{
h ^= (BitConverter.ToUInt64(remainder, x * 8) * _primes64[1]).RotateLeft(31) * _primes64[0];
h = (h.RotateLeft(27) * _primes64[0]) + _primes64[3];
}
// Process a 4-byte chunk if it exists
if ((remainder.Length % 8) > 4)
{
h ^= ((UInt64) BitConverter.ToUInt32(remainder, remainder.Length - (remainder.Length % 8))) * _primes64[0];
h = (h.RotateLeft(23) * _primes64[1]) + _primes64[2];
}
// Process last 4 bytes in 1-byte chunks (only runs if data.Length % 4 != 0)
for (int x = remainder.Length - (remainder.Length % 4); x < remainder.Length; ++x)
{
h ^= (UInt64) remainder[x] * _primes64[4];
h = h.RotateLeft(11) * _primes64[0];
}
}
h ^= h >> 33;
h *= _primes64[1];
h ^= h >> 29;
h *= _primes64[2];
h ^= h >> 32;
}
示例2: ProcessGroup
private static void ProcessGroup(ref UInt64 h1, ref UInt64 h2, byte[] dataGroup, int position, int length)
{
for (var x = position; x < position + length; x += 16)
{
UInt64 k1 = BitConverter.ToUInt64(dataGroup, 0);
UInt64 k2 = BitConverter.ToUInt64(dataGroup, 8);
k1 *= c1_128;
k1 = k1.RotateLeft(31);
k1 *= c2_128;
h1 ^= k1;
h1 = h1.RotateLeft(27);
h1 += h2;
h1 = (h1 * 5) + 0x52dce729;
k2 *= c2_128;
k2 = k2.RotateLeft(33);
k2 *= c1_128;
h2 ^= k2;
h2 = h2.RotateLeft(31);
h2 += h1;
h2 = (h2 * 5) + 0x38495ab5;
}
}