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

◆ IcuGetHashCodeOfString()

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

Definition at line 1755 of file CompareInfo.cs.

1756 {
1757 int num = ((source.Length <= 262144) ? (4 * source.Length) : 0);
1758 byte[] array = null;
1759 Span<byte> span = ((num > 1024) ? ((Span<byte>)(array = ArrayPool<byte>.Shared.Rent(num))) : stackalloc byte[1024]);
1761 fixed (char* str = &MemoryMarshal.GetNonNullPinnableReference(source))
1762 {
1763 fixed (byte* sortKey = &MemoryMarshal.GetReference(span2))
1764 {
1766 }
1767 if (num > span2.Length)
1768 {
1769 if (array != null)
1770 {
1771 ArrayPool<byte>.Shared.Return(array);
1772 }
1773 span2 = (array = ArrayPool<byte>.Shared.Rent(num));
1774 fixed (byte* sortKey2 = &MemoryMarshal.GetReference(span2))
1775 {
1777 }
1778 }
1779 }
1780 if (num == 0 || num > span2.Length)
1781 {
1782 throw new ArgumentException(SR.Arg_ExternalException);
1783 }
1784 int result = Marvin.ComputeHash32(span2.Slice(0, num), Marvin.DefaultSeed);
1785 if (array != null)
1786 {
1787 ArrayPool<byte>.Shared.Return(array);
1788 }
1789 return result;
1790 }
static unsafe int GetSortKey(IntPtr sortHandle, char *str, int strLength, byte *sortKey, int sortKeyLength, CompareOptions options)

References System.Globalization.CompareInfo._sortHandle, System.SR.Arg_ExternalException, System.array, System.Marvin.ComputeHash32(), System.Marvin.DefaultSeed, System.Runtime.Serialization.Dictionary, Interop.Globalization.GetSortKey(), System.options, System.source, and System.str.

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