Skip to content

Commit 500c4e3

Browse files
committed
Fix debug assert
1 parent 70ff070 commit 500c4e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public static bool Equals<TValueLength>(ref char matchStart, ref readonly Single
347347
// See comments on SingleStringSearchValuesPackedThreeChars.CanSkipAnchorMatchVerification.
348348
// When running on Arm64, this helper is also used to confirm vectorized anchor matches.
349349
// We do so because we're using UnzipEven when packing inputs, which may produce false positive anchor matches.
350-
Debug.Assert((matchStart & 0xFF) == state.Value[0]);
350+
Debug.Assert(TransformInput((char)(matchStart & 0xFF)) == state.Value[0]);
351351

352352
uint differentBits = (Unsafe.ReadUnaligned<uint>(ref matchByteStart) & CaseMask) - state.Value32_0;
353353
differentBits |= (Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) & CaseMask) - state.Value32_1;
@@ -359,7 +359,7 @@ public static bool Equals<TValueLength>(ref char matchStart, ref readonly Single
359359
// It's only used as part of the scalar search loop, which always checks that the first character matches before calling this helper.
360360
// We know that the candidate is 2 or 3 characters long, and that the first character has already been checked.
361361
// We only have to to check whether the last 2 characters also match.
362-
Debug.Assert(matchStart == state.Value[0], "This should only be called after the first character has been checked");
362+
Debug.Assert(TransformInput(matchStart) == state.Value[0], "This should only be called after the first character has been checked");
363363

364364
return (Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) & CaseMask) == state.Value32_1;
365365
}

0 commit comments

Comments
 (0)