Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ NlsGetHashCodeOfString()

unsafe int System.Globalization.CompareInfo.NlsGetHashCodeOfString ( ReadOnlySpan< char > source,
CompareOptions options )
inlineprivate

Definition at line 1935 of file CompareInfo.cs.

1936 {
1937 if (!Environment.IsWindows8OrAbove)
1938 {
1939 source = source.ToString();
1940 }
1941 int num = source.Length;
1942 if (num == 0)
1943 {
1944 source = string.Empty;
1945 num = -1;
1946 }
1947 uint dwMapFlags = 0x400u | (uint)GetNativeCompareFlags(options);
1948 fixed (char* lpSrcStr = &MemoryMarshal.GetReference(source))
1949 {
1951 if (num2 == 0)
1952 {
1953 throw new ArgumentException(SR.Arg_ExternalException);
1954 }
1955 byte[] array = null;
1956 Span<byte> span = ((num2 > 512) ? ((Span<byte>)(array = ArrayPool<byte>.Shared.Rent(num2))) : stackalloc byte[512]);
1958 fixed (byte* lpDestStr = &MemoryMarshal.GetReference(span2))
1959 {
1961 {
1962 throw new ArgumentException(SR.Arg_ExternalException);
1963 }
1964 }
1965 int result = Marvin.ComputeHash32(span2.Slice(0, num2), Marvin.DefaultSeed);
1966 if (array != null)
1967 {
1968 ArrayPool<byte>.Shared.Return(array);
1969 }
1970 return result;
1971 }
1972 }
static unsafe int LCMapStringEx(string lpLocaleName, uint dwMapFlags, char *lpSrcStr, int cchSrc, void *lpDestStr, int cchDest, void *lpVersionInformation, void *lpReserved, IntPtr sortHandle)
static int GetNativeCompareFlags(CompareOptions options)

References System.Globalization.CompareInfo._sortHandle, System.Globalization.CompareInfo._sortName, System.SR.Arg_ExternalException, System.array, System.Marvin.ComputeHash32(), System.Marvin.DefaultSeed, System.Runtime.Serialization.Dictionary, System.Globalization.CompareInfo.GetNativeCompareFlags(), System.Environment.IsWindows8OrAbove, Interop.Kernel32.LCMapStringEx(), System.options, System.source, and System.IntPtr.Zero.

Referenced by System.Globalization.CompareInfo.GetHashCodeOfStringCore().