Skip to content

Commit 1d055a1

Browse files
committed
Removed unnecessary type checks
1 parent fdee563 commit 1d055a1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Microsoft.Toolkit.HighPerformance/Helpers/Internals/SpanHelper.Count.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,28 +242,22 @@ private static nint CountSimd<T>(ref T r0, nint length, T value)
242242
private static unsafe nint GetUpperBound<T>()
243243
where T : unmanaged
244244
{
245-
if (typeof(T) == typeof(byte) ||
246-
typeof(T) == typeof(sbyte) ||
247-
typeof(T) == typeof(bool))
245+
if (typeof(T) == typeof(byte))
248246
{
249247
return sbyte.MaxValue;
250248
}
251249

252-
if (typeof(T) == typeof(char) ||
253-
typeof(T) == typeof(ushort) ||
254-
typeof(T) == typeof(short))
250+
if (typeof(T) == typeof(short))
255251
{
256252
return short.MaxValue;
257253
}
258254

259-
if (typeof(T) == typeof(int) ||
260-
typeof(T) == typeof(uint))
255+
if (typeof(T) == typeof(int))
261256
{
262257
return int.MaxValue;
263258
}
264259

265-
if (typeof(T) == typeof(long) ||
266-
typeof(T) == typeof(ulong))
260+
if (typeof(T) == typeof(long))
267261
{
268262
if (sizeof(nint) == sizeof(int))
269263
{

0 commit comments

Comments
 (0)