Skip to content

Commit

Permalink
fix: fix missing identifier when simd is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 6, 2024
1 parent f28944e commit de136c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/native/lib.d
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ private bool hasNoSlashOrEvenNumberOfSlashes(in string leftContextSubstr) @safe
return slashCount % 2 == 0;
}

private bool notSlashAndNoSpaceOrBreak(const ref string matchFrontHit) @safe
private bool notSlashAndNoSpaceOrBreak(const ref string str) @safe
{
return matchFrontHit != "\"" && hasNoSpace(matchFrontHit);
return str != "\"" && hasNoSpace(str);
}

/** Removes spaces from the original string */
Expand All @@ -141,24 +141,24 @@ private string remove_spaces(string str) @trusted nothrow
else
{
const spaceOrBreakRegex = ctRegex!(`\s`);
leftContextSubstr.replaceAll(spaceOrBreakRegex, "");
str.replaceAll(spaceOrBreakRegex, "");
}
}

/** Check if the given string has space */
private bool hasNoSpace(const ref string matchFrontHit) @trusted
private bool hasNoSpace(const ref string str) @trusted
{
static if (supports_avx2())
{
import despacer.despacer : avx2_hasspace;

// the algorithm never checks for zero termination so toStringz is not needed
return !avx2_hasspace(cast(const char*) matchFrontHit, matchFrontHit.length);
return !avx2_hasspace(cast(const char*) str, str.length);
}
else
{
const spaceOrBreakRegex = ctRegex!(`\s`);
return matchFrontHit.matchFirst(spaceOrBreakRegex).empty();
return str.matchFirst(spaceOrBreakRegex).empty();
}
}

Expand Down

0 comments on commit de136c3

Please sign in to comment.