< Summary

Information
Class: System.Buffers.Any1CharPackedIgnoreCaseSearchValues
Assembly: System.Private.CoreLib
File(s): D:\runner\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1CharPackedIgnoreCaseSearchValues.cs
Line coverage
91%
Covered lines: 11
Uncovered lines: 1
Coverable lines: 12
Total lines: 52
Line coverage: 91.6%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
GetValues()100%110%
ContainsCore(...)100%11100%
IndexOfAny(...)100%11100%
IndexOfAnyExcept(...)100%11100%
LastIndexOfAny(...)100%11100%
LastIndexOfAnyExcept(...)100%11100%

File(s)

D:\runner\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1CharPackedIgnoreCaseSearchValues.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
 4using System.Diagnostics;
 5using System.Runtime.CompilerServices;
 6using System.Runtime.InteropServices;
 7using System.Runtime.Intrinsics.X86;
 8
 9namespace System.Buffers
 10{
 11    internal sealed class Any1CharPackedIgnoreCaseSearchValues : SearchValues<char>
 12    {
 13        // While this most commonly applies to ASCII letters, it also works for other values that differ by 0x20 (e.g. "
 14        // _lowerCase is therefore not necessarily a lower case ASCII letter, but just the higher value (the one with th
 15        private readonly char _lowerCase, _upperCase;
 16        private readonly uint _lowerCaseUint;
 17
 15318        public Any1CharPackedIgnoreCaseSearchValues(char value)
 19        {
 15320            Debug.Assert((value | 0x20) == value);
 21
 15322            _lowerCase = value;
 15323            _upperCase = (char)(value & ~0x20);
 15324            _lowerCaseUint = value;
 15325        }
 26
 27        internal override char[] GetValues() =>
 028            [_upperCase, _lowerCase];
 29
 30        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 31        internal override bool ContainsCore(char value) =>
 4720532            (uint)(value | 0x20) == _lowerCaseUint;
 33
 34        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 35        [CompExactlyDependsOn(typeof(Sse2))]
 36        internal override int IndexOfAny(ReadOnlySpan<char> span) =>
 61237            PackedSpanHelpers.IndexOfAnyIgnoreCase(ref MemoryMarshal.GetReference(span), _lowerCase, span.Length);
 38
 39        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 40        [CompExactlyDependsOn(typeof(Sse2))]
 41        internal override int IndexOfAnyExcept(ReadOnlySpan<char> span) =>
 61242            PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref MemoryMarshal.GetReference(span), _lowerCase, span.Length);
 43
 44        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 45        internal override int LastIndexOfAny(ReadOnlySpan<char> span) =>
 30646            span.LastIndexOfAny(_lowerCase, _upperCase);
 47
 48        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 49        internal override int LastIndexOfAnyExcept(ReadOnlySpan<char> span) =>
 30650            span.LastIndexOfAnyExcept(_lowerCase, _upperCase);
 51    }
 52}