private unsafe int GetHashCodeBigEndian()

in Microsoft.Shared.Dna.Hash/AffineHash.cs [570:592]


        private unsafe int GetHashCodeBigEndian(char* valuePointer, int length)
        {
            ulong result = 0UL;
            ulong block = 0UL;
            int remainder = length & 1; // mod 2
            int cutoff = length - remainder;
            int i = 0;
            while (i < cutoff)
            {
                block =
                    ((ulong)(*(valuePointer + i++)) << 16) |
                    ((ulong)(*(valuePointer + i++)));
                result = this.ComputeSmallBlock(result + block);
            }

            if (remainder == 0)
            {
                return (int)result;
            }

            block = (ulong)(*(valuePointer + cutoff)) << 16;
            return (int)this.ComputeBigBlock(result + block);
        }