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

◆ TryParseAsSpecialFloatingPoint< T >()

static bool System.Buffers.Text.Utf8Parser.TryParseAsSpecialFloatingPoint< T > ( ReadOnlySpan< byte > source,
T positiveInfinity,
T negativeInfinity,
T nan,
out T value,
out int bytesConsumed )
inlinestaticprivate
Type Constraints
T :struct 

Definition at line 1060 of file Utf8Parser.cs.

1060 : struct
1061 {
1062 int num = 0;
1063 int num2 = source.Length;
1064 bool flag = false;
1065 if (num2 >= 4)
1066 {
1067 byte b = source[num];
1068 if (b != 43)
1069 {
1070 if (b != 45)
1071 {
1072 goto IL_002e;
1073 }
1074 flag = true;
1075 }
1076 num++;
1077 num2--;
1078 }
1079 goto IL_002e;
1080 IL_002e:
1081 if (num2 >= 3)
1082 {
1083 if (((source[num] ^ 0x6E) & -33) == 0 && ((source[num + 1] ^ 0x61) & -33) == 0 && ((source[num + 2] ^ 0x6E) & -33) == 0)
1084 {
1085 value = nan;
1086 bytesConsumed = 3 + num;
1087 return true;
1088 }
1089 if (num2 >= 8)
1090 {
1091 int num3 = BinaryPrimitives.ReadInt32LittleEndian(source.Slice(num)) ^ 0x69666E69;
1092 if ((num3 & -538976289) == 0)
1093 {
1094 num3 = BinaryPrimitives.ReadInt32LittleEndian(source.Slice(num + 4)) ^ 0x7974696E;
1095 if ((num3 & -538976289) == 0)
1096 {
1097 value = (flag ? negativeInfinity : positiveInfinity);
1098 bytesConsumed = 8 + num;
1099 return true;
1100 }
1101 }
1102 }
1103 }
1104 value = default(T);
1105 bytesConsumed = 0;
1106 return false;
1107 }
static int ReadInt32LittleEndian(ReadOnlySpan< byte > source)

References System.Buffers.Binary.BinaryPrimitives.ReadInt32LittleEndian(), System.source, and System.value.