예제 #1
0
        public static int CombineValue(int value, int seed)
        {
            var combinedHashCode = CombinePartialValue(value, seed);

            unchecked
            {
                combinedHashCode  = IntegerUtilities.RotateLeft(combinedHashCode, 13);
                combinedHashCode *= 5;
                combinedHashCode -= 430675100;
            }

            return(combinedHashCode);
        }
예제 #2
0
        public static int CombinePartialValue(int partialValue, int seed)
        {
            var combinedHashCode = partialValue;

            unchecked
            {
                combinedHashCode *= (-862048943);
                combinedHashCode  = IntegerUtilities.RotateLeft(combinedHashCode, 15);

                combinedHashCode *= 461845907;
                combinedHashCode ^= seed;
            }

            return(combinedHashCode);
        }