diff --git a/components/core/src/ir/parsing.cpp b/components/core/src/ir/parsing.cpp index c6cc9d1d5..6b9ebf08b 100644 --- a/components/core/src/ir/parsing.cpp +++ b/components/core/src/ir/parsing.cpp @@ -23,23 +23,6 @@ bool is_variable_placeholder(char c) { || (enum_to_underlying_type(VariablePlaceholder::Float) == c); } -// NOTE: `inline` improves performance by 1-2% -inline bool could_be_multi_digit_hex_value(string_view str) { - if (str.length() < 2) { - return false; - } - - // NOTE: This is 1-2% faster than using std::all_of with the opposite - // condition - for (auto c : str) { - if (!(('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || ('0' <= c && c <= '9'))) { - return false; - } - } - - return true; -} - bool is_var(std::string_view value) { size_t begin_pos = 0; size_t end_pos = 0; diff --git a/components/core/src/ir/parsing.hpp b/components/core/src/ir/parsing.hpp index 99405cc15..a5d447728 100644 --- a/components/core/src/ir/parsing.hpp +++ b/components/core/src/ir/parsing.hpp @@ -37,10 +37,25 @@ bool is_delim(signed char c); bool is_variable_placeholder(char c); /** + * NOTE: This method is marked inline for a 1-2% performance improvement * @param str * @return Whether the given string could be a multi-digit hex value */ -bool could_be_multi_digit_hex_value(std::string_view str); +inline bool could_be_multi_digit_hex_value(std::string_view str) { + if (str.length() < 2) { + return false; + } + + // NOTE: This is 1-2% faster than using std::all_of with the opposite + // condition + for (auto c : str) { + if (!(('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || ('0' <= c && c <= '9'))) { + return false; + } + } + + return true; +} /** * @param value