Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2022-09-30 05:14:30 +0300
committerGitHub <noreply@github.com>2022-09-30 05:14:30 +0300
commitf58fde50376479ad3ba1339d37df816f90bff287 (patch)
treef433281e2b32b14f7d6ab4b2f0a08a3c8fa82d37 /src
parentbfef7ccc856ac307fd5102c00ea54ddbe0b06fa3 (diff)
Remove some dead code from Array.IndexOf (#76388)
Diffstat (limited to 'src')
-rw-r--r--src/libraries/System.Private.CoreLib/src/System/Array.cs26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/libraries/System.Private.CoreLib/src/System/Array.cs b/src/libraries/System.Private.CoreLib/src/System/Array.cs
index eac471e826e..2e9f5f2e6c8 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Array.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Array.cs
@@ -1345,28 +1345,18 @@ namespace System
}
else if (Unsafe.SizeOf<T>() == sizeof(int))
{
- int result = typeof(T).IsValueType
- ? SpanHelpers.IndexOfValueType(
- ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<int[]>(array)), startIndex),
- Unsafe.As<T, int>(ref value),
- count)
- : SpanHelpers.IndexOf(
- ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<int[]>(array)), startIndex),
- Unsafe.As<T, int>(ref value),
- count);
+ int result = SpanHelpers.IndexOfValueType(
+ ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<int[]>(array)), startIndex),
+ Unsafe.As<T, int>(ref value),
+ count);
return (result >= 0 ? startIndex : 0) + result;
}
else if (Unsafe.SizeOf<T>() == sizeof(long))
{
- int result = typeof(T).IsValueType
- ? SpanHelpers.IndexOfValueType(
- ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<long[]>(array)), startIndex),
- Unsafe.As<T, long>(ref value),
- count)
- : SpanHelpers.IndexOf(
- ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<long[]>(array)), startIndex),
- Unsafe.As<T, long>(ref value),
- count);
+ int result = SpanHelpers.IndexOfValueType(
+ ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<long[]>(array)), startIndex),
+ Unsafe.As<T, long>(ref value),
+ count);
return (result >= 0 ? startIndex : 0) + result;
}
}