mirror of https://github.com/stella-emu/stella.git
Minor string optimizations.
This commit is contained in:
parent
ca59a8f3c8
commit
bdffdd7b9d
|
@ -427,7 +427,8 @@ namespace BSPF
|
||||||
|
|
||||||
inline bool isWhiteSpace(const char c)
|
inline bool isWhiteSpace(const char c)
|
||||||
{
|
{
|
||||||
return string(" ,.;:+-*&/\\'").find(c) != string::npos;
|
static constexpr string_view spaces{" ,.;:+-*&/\\'"};
|
||||||
|
return spaces.find(c) != string_view::npos;
|
||||||
}
|
}
|
||||||
} // namespace BSPF
|
} // namespace BSPF
|
||||||
|
|
||||||
|
|
|
@ -411,7 +411,8 @@ class FBSurface
|
||||||
@return True if whitespace character
|
@return True if whitespace character
|
||||||
*/
|
*/
|
||||||
static bool isWhiteSpace(const char c) {
|
static bool isWhiteSpace(const char c) {
|
||||||
return string(" ,.;:+-*/\\'([\n").find(c) != string::npos;
|
static constexpr string_view spaces{" ,.;:+-*/\\'([\n"};
|
||||||
|
return spaces.find(c) != string_view::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue