Skip to content

Commit 988fde5

Browse files
authored
Fix SearchValues asserts for WASM (#118030)
1 parent b20632e commit 988fde5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libraries/System.Private.CoreLib/src/System/SearchValues/AsciiByteSearchValues.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ internal sealed class AsciiByteSearchValues<TUniqueLowNibble> : SearchValues<byt
1818

1919
public AsciiByteSearchValues(ReadOnlySpan<byte> values)
2020
{
21-
// Despite the name being Ascii, this type may be used with non-ASCII values on ARM.
22-
// See IndexOfAnyAsciiSearcher.CanUseUniqueLowNibbleSearch.
23-
Debug.Assert(Ascii.IsValid(values) || (AdvSimd.IsSupported && TUniqueLowNibble.Value));
21+
// Despite the name being Ascii, this type may be used with non-ASCII values on ARM or WASM.
22+
// See comments in IndexOfAnyAsciiSearcher.CanUseUniqueLowNibbleSearch.
23+
Debug.Assert(Ascii.IsValid(values) || (TUniqueLowNibble.Value && (AdvSimd.IsSupported || PackedSimd.IsSupported)));
2424

2525
if (TUniqueLowNibble.Value)
2626
{

src/libraries/System.Private.CoreLib/src/System/SearchValues/AsciiCharSearchValues.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ internal sealed class AsciiCharSearchValues<TOptimizations, TUniqueLowNibble> :
1919

2020
public AsciiCharSearchValues(ReadOnlySpan<char> values)
2121
{
22-
// Despite the name being Ascii, this type may be used with non-ASCII values on ARM.
23-
// See IndexOfAnyAsciiSearcher.CanUseUniqueLowNibbleSearch.
24-
Debug.Assert(Ascii.IsValid(values) || (AdvSimd.IsSupported && TUniqueLowNibble.Value));
22+
// Despite the name being Ascii, this type may be used with non-ASCII values on ARM or WASM.
23+
// See comments in IndexOfAnyAsciiSearcher.CanUseUniqueLowNibbleSearch.
24+
Debug.Assert(Ascii.IsValid(values) || (TUniqueLowNibble.Value && (AdvSimd.IsSupported || PackedSimd.IsSupported)));
25+
Debug.Assert(!values.ContainsAnyInRange((char)byte.MaxValue, char.MaxValue));
2526

2627
if (TUniqueLowNibble.Value)
2728
{

0 commit comments

Comments
 (0)