Fixed a bug in FastCharSearch.

Reader buffer is now manually allocated, decreasing GC workload
even further.
This commit is contained in:
Ferdinand Majerech 2011-10-25 00:16:43 +02:00
parent 97bdf819fa
commit 8b995e5061
3 changed files with 38 additions and 22 deletions

View file

@ -81,22 +81,16 @@ string searchCode(dstring chars, uint tableSize)()
if(tableSize)
{
code ~= specialChars.length
?
" if(c < " ~ tableSizeStr ~ ")\n"
code ~= " if(c < " ~ tableSizeStr ~ ")\n"
" {\n"
" return cast(bool)table_[c];\n"
" }\n"
:
" return cast(bool)table_[c];\n";
}
if(specialChars.length)
{
code ~= " return " ~ specialCharsCode() ~ ";\n";
" }\n";
}
code ~= " assert(false);\n"
"}\n";
code ~= specialChars.length
? " return " ~ specialCharsCode() ~ ";\n"
: " return false";
code ~= "}\n";
return code;
}