< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 25
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
IgnoreCaseMask(...)0%220%
IsEqualAscii(...)0%440%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/StringUtils.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Reflection.Metadata
 5{
 6    internal static class StringUtils
 7    {
 8        internal static int IgnoreCaseMask(bool ignoreCase)
 09        {
 010            return ignoreCase ? 0x20 : 0xff;
 011        }
 12
 13        internal static bool IsEqualAscii(int a, int b, int ignoreCaseMask)
 014        {
 15            // When not ignoring case (most often):
 16            // - only the first condition is evaluated multiple times during the loop.
 17            // - the remaining condition is false since ignoreCaseMask is 0xff.
 18            // When ignoring case
 19            // - the most likely case is still a == b
 20            // - ignoreCaseMask is 0x20
 021            return a == b || ((a | 0x20) == (b | 0x20) && unchecked((uint)((a | ignoreCaseMask) - 'a')) <= 'z' - 'a');
 022        }
 23    }
 24}
 25