コード例 #1
0
ファイル: String.Comparison.cs プロジェクト: pongba/corert
        public override int GetHashCode()
        {
            ulong seed = Marvin.DefaultSeed;

            // Multiplication below will not overflow since going from positive Int32 to UInt32.
            return(Marvin.ComputeHash32(ref Unsafe.As <char, byte>(ref _firstChar), (uint)_stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)));
        }
コード例 #2
0
ファイル: String.Comparison.cs プロジェクト: pongba/corert
        public static int GetHashCode(ReadOnlySpan <char> value)
        {
            ulong seed = Marvin.DefaultSeed;

            // Multiplication below will not overflow since going from positive Int32 to UInt32.
            return(Marvin.ComputeHash32(ref Unsafe.As <char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)));
        }
コード例 #3
0
        // Gets a hash code for this string.  If strings A and B are such that A.Equals(B), then
        // they will return the same hash code.
        public override int GetHashCode()
        {
#if MONO
            return(LegacyStringGetHashCode());
#else
            return(Marvin.ComputeHash32(ref Unsafe.As <char, byte>(ref _firstChar), _stringLength * 2, Marvin.DefaultSeed));
#endif
        }
コード例 #4
0
ファイル: Utf8String.cs プロジェクト: vebin/runtime
        /// <summary>
        /// Returns a hash code using a <see cref="StringComparison.Ordinal"/> comparison.
        /// </summary>
        public override int GetHashCode()
        {
            // TODO_UTF8STRING: Consider whether this should use a different seed than String.GetHashCode.

            ulong seed = Marvin.DefaultSeed;

            return(Marvin.ComputeHash32(ref DangerousGetMutableReference(), (uint)_length /* in bytes */, (uint)seed, (uint)(seed >> 32)));
        }
コード例 #5
0
 // Gets a hash code for this string.  If strings A and B are such that A.Equals(B), then
 // they will return the same hash code.
 public override int GetHashCode()
 {
     return(Marvin.ComputeHash32(ref Unsafe.As <char, byte>(ref _firstChar), _stringLength * 2, Marvin.DefaultSeed));
 }
コード例 #6
0
ファイル: String.Comparison.cs プロジェクト: z1c0/corert
        public static int GetHashCode(ReadOnlySpan <char> value)
        {
            ulong seed = Marvin.DefaultSeed;

            return(Marvin.ComputeHash32(ref Unsafe.As <char, byte>(ref MemoryMarshal.GetReference(value)), value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)));
        }
コード例 #7
0
ファイル: String.Comparison.cs プロジェクト: z1c0/corert
        public override int GetHashCode()
        {
            ulong seed = Marvin.DefaultSeed;

            return(Marvin.ComputeHash32(ref Unsafe.As <char, byte>(ref _firstChar), _stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)));
        }