summaryrefslogtreecommitdiff
path: root/src/regex_impl.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-04-27 08:18:04 +1000
committerMaxime Coste <mawww@kakoune.org>2018-04-27 08:35:09 +1000
commitf10eb9faa30428172033a4e4e689a76b7b0510c2 (patch)
treec95b62b7727709d5ff51b10eb1d330dbdbd5766c /src/regex_impl.cc
parent869736359a4b72609327e4f0b9f2c3682f5cce8a (diff)
Use indices instead of pointers for saves/instruction in ThreadedRegexVM
Performance seems unaffacted, but memory usage should be lowered as the Thread struct is 4 bytes instead of 16.
Diffstat (limited to 'src/regex_impl.cc')
-rw-r--r--src/regex_impl.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/regex_impl.cc b/src/regex_impl.cc
index bf32cde2..0202cb85 100644
--- a/src/regex_impl.cc
+++ b/src/regex_impl.cc
@@ -551,7 +551,7 @@ private:
NodeIndex new_node(ParsedRegex::Op op, Codepoint value = -1,
ParsedRegex::Quantifier quantifier = {ParsedRegex::Quantifier::One})
{
- constexpr auto max_nodes = std::numeric_limits<uint16_t>::max();
+ constexpr auto max_nodes = std::numeric_limits<int16_t>::max();
const NodeIndex res = m_parsed_regex.nodes.size();
if (res == max_nodes)
parse_error(format("regex parsed to more than {} ast nodes", max_nodes));
@@ -837,7 +837,7 @@ private:
uint32_t push_inst(CompiledRegex::Op op, uint32_t param = 0)
{
- constexpr auto max_instructions = std::numeric_limits<uint16_t>::max();
+ constexpr auto max_instructions = std::numeric_limits<int16_t>::max();
const uint32_t res = m_program.instructions.size();
if (res > max_instructions)
throw regex_error(format("regex compiled to more than {} instructions", max_instructions));