Elide bounds check for MethodToString (#7887)
This commit is contained in:
parent
b9fda976c0
commit
19b52bdc8b
|
|
@ -410,10 +410,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure
|
||||||
}
|
}
|
||||||
public static string MethodToString(HttpMethod method)
|
public static string MethodToString(HttpMethod method)
|
||||||
{
|
{
|
||||||
int methodIndex = (int)method;
|
var methodIndex = (int)method;
|
||||||
if (methodIndex >= 0 && methodIndex <= 8)
|
var methodNames = _methodNames;
|
||||||
|
if ((uint)methodIndex < (uint)methodNames.Length)
|
||||||
{
|
{
|
||||||
return _methodNames[methodIndex];
|
return methodNames[methodIndex];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue