static bool ParseIP(string s)
{
if (s.Length > 15)
{
return false;
}
Span<ushort> value = stackalloc ushort[16];
value[s.Length] = '.';
Consume(value);
return true;
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Consume<T>(Span<T> _)
{
}
Currently, value[s.Length] = '.'; line produces a bound check while it shouldn't.
Currently,
value[s.Length] = '.';line produces a bound check while it shouldn't.