| | | 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 | | |
| | | 4 | | using System.Runtime.CompilerServices; |
| | | 5 | | using System.Runtime.InteropServices; |
| | | 6 | | |
| | | 7 | | namespace System.Buffers |
| | | 8 | | { |
| | | 9 | | internal sealed class ProbabilisticCharSearchValues : SearchValues<char> |
| | | 10 | | { |
| | | 11 | | private ProbabilisticMapState _map; |
| | | 12 | | |
| | 0 | 13 | | public ProbabilisticCharSearchValues(ReadOnlySpan<char> values, int maxInclusive) |
| | | 14 | | { |
| | 0 | 15 | | _map = new ProbabilisticMapState(values, maxInclusive); |
| | 0 | 16 | | } |
| | | 17 | | |
| | | 18 | | internal override char[] GetValues() => |
| | 0 | 19 | | _map.GetValues(); |
| | | 20 | | |
| | | 21 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 22 | | internal override bool ContainsCore(char value) => |
| | 0 | 23 | | _map.FastContains(value); |
| | | 24 | | |
| | | 25 | | internal override int IndexOfAny(ReadOnlySpan<char> span) => |
| | 0 | 26 | | ProbabilisticMap.IndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _ |
| | | 27 | | |
| | | 28 | | internal override int IndexOfAnyExcept(ReadOnlySpan<char> span) => |
| | 0 | 29 | | ProbabilisticMapState.IndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref Memor |
| | | 30 | | |
| | | 31 | | internal override int LastIndexOfAny(ReadOnlySpan<char> span) => |
| | 0 | 32 | | ProbabilisticMap.LastIndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, r |
| | | 33 | | |
| | | 34 | | internal override int LastIndexOfAnyExcept(ReadOnlySpan<char> span) => |
| | 0 | 35 | | ProbabilisticMapState.LastIndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref M |
| | | 36 | | } |
| | | 37 | | } |
| | | 38 | | |