Move away from macro, get slight perf boost with hand rolled compare
This commit is contained in:
parent
95e119fffe
commit
5f402e71dd
@ -439,14 +439,19 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
/// Reads a symbol group from input if it matches the parameter, without skipping initial whitespace
|
/// Reads a symbol group from input if it matches the parameter, without skipping initial whitespace
|
||||||
#define Symbol_(t_s, len) \
|
inline bool Symbol_(const char *t_s, const size_t len)
|
||||||
( \
|
{
|
||||||
m_position.remaining() >= len \
|
if (m_position.remaining() >= len) {
|
||||||
? std::memcmp(t_s, &(*m_position), len) == 0 \
|
const char *file_pos = &(*m_position);
|
||||||
? ((m_position += len),true) \
|
for (size_t pos = 0; pos < len; ++pos)
|
||||||
:false \
|
{
|
||||||
:false \
|
if (t_s[pos] != file_pos[pos]) { return false; }
|
||||||
)
|
}
|
||||||
|
m_position += len;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Skips any multi-line or single-line comment
|
/// Skips any multi-line or single-line comment
|
||||||
bool SkipComment() {
|
bool SkipComment() {
|
||||||
@ -2540,8 +2545,6 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef Symbol_
|
|
||||||
|
|
||||||
#if defined(CHAISCRIPT_MSVC) && defined(CHAISCRIPT_PUSHED_MIN_MAX)
|
#if defined(CHAISCRIPT_MSVC) && defined(CHAISCRIPT_PUSHED_MIN_MAX)
|
||||||
#undef CHAISCRIPT_PUSHED_MIN_MAX
|
#undef CHAISCRIPT_PUSHED_MIN_MAX
|
||||||
#pragma pop_macro("min")
|
#pragma pop_macro("min")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user