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

◆ MakeSeparatorList() [1/3]

unsafe void System.String.MakeSeparatorList ( ReadOnlySpan< char > separators,
ref ValueListBuilder< int > sepListBuilder )
inlineprivate

Definition at line 2841 of file String.cs.

2842 {
2843 if (separators.Length == 0)
2844 {
2845 for (int i = 0; i < Length; i++)
2846 {
2847 if (char.IsWhiteSpace(this[i]))
2848 {
2849 sepListBuilder.Append(i);
2850 }
2851 }
2852 return;
2853 }
2854 if (separators.Length <= 3)
2855 {
2856 char c = separators[0];
2857 char c2 = ((separators.Length > 1) ? separators[1] : c);
2858 char c3 = ((separators.Length > 2) ? separators[2] : c2);
2859 if (Length >= 16 && Sse41.IsSupported)
2860 {
2862 return;
2863 }
2864 for (int j = 0; j < Length; j++)
2865 {
2866 char c4 = this[j];
2867 if (c4 == c || c4 == c2 || c4 == c3)
2868 {
2869 sepListBuilder.Append(j);
2870 }
2871 }
2872 return;
2873 }
2874 ProbabilisticMap probabilisticMap = default(ProbabilisticMap);
2875 uint* charMap = (uint*)(&probabilisticMap);
2877 for (int k = 0; k < Length; k++)
2878 {
2879 char c5 = this[k];
2880 if (IsCharBitSet(charMap, (byte)c5) && IsCharBitSet(charMap, (byte)((int)c5 >> 8)) && separators.Contains(c5))
2881 {
2882 sepListBuilder.Append(k);
2883 }
2884 }
2885 }
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
static unsafe void InitializeProbabilisticMap(uint *charMap, ReadOnlySpan< char > anyOf)
Definition String.cs:3337
static unsafe bool IsCharBitSet(uint *charMap, byte value)
Definition String.cs:3372
void MakeSeparatorListVectorized(ref ValueListBuilder< int > sepListBuilder, char c, char c2, char c3)
Definition String.cs:2887

References System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.String.InitializeProbabilisticMap(), System.String.IsCharBitSet(), System.Runtime.Intrinsics.X86.Sse41.IsSupported, System.String.Length, and System.String.MakeSeparatorListVectorized().

Referenced by System.String.SplitInternal(), System.String.SplitInternal(), and System.String.SplitInternal().