Skip to content

Commit

Permalink
lets be about 0.6ns faster by actually using contains for contains
Browse files Browse the repository at this point in the history
  • Loading branch information
h3xds1nz committed Jun 7, 2024
1 parent 1982597 commit 4f9f766
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal static bool AlwaysAdjacent(CultureInfo ci)
'\x00AD' // Soft-Hyphen
];

internal static bool IsHyphen(char target) => HyphenSet.IndexOf(target) > -1;
internal static bool IsHyphen(char target) => HyphenSet.Contains(target);

// Space that was used in the heuristic algorithm.
internal static bool IsSpace(char target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ internal static bool IsNextToPlainLineBreak(ITextPointer thisPosition, LogicalDi
internal static ReadOnlySpan<char> NextLineCharacters => ['\n', '\r', '\v', '\f', '\u0085' /*NEL*/, '\u2028' /*LS*/, '\u2029' /*PS*/];

// Returns true if a specified char matches the Unicode definition of "newline".
internal static bool IsCharUnicodeNewLine(char ch) => NextLineCharacters.IndexOf(ch) > -1;
internal static bool IsCharUnicodeNewLine(char ch) => NextLineCharacters.Contains(ch);

/// <summary>
/// Returns true if the position is adjacent to a LineBreak element,
Expand Down

0 comments on commit 4f9f766

Please # to comment.