diff --git a/AK/DisjointChunks.h b/AK/DisjointChunks.h index 60ed379367e..1da9736e510 100644 --- a/AK/DisjointChunks.h +++ b/AK/DisjointChunks.h @@ -357,6 +357,12 @@ public: return true; } + [[nodiscard]] ReadonlySpan flat_data() const + { + VERIFY(m_chunks.size() <= 1); + return m_chunks.is_empty() ? ReadonlySpan {} : m_chunks.first().span(); + } + DisjointChunks release_slice(size_t start, size_t length) & { return move(*this).slice(start, length); } DisjointChunks release_slice(size_t start) & { return move(*this).slice(start); } diff --git a/Libraries/LibRegex/RegexByteCode.cpp b/Libraries/LibRegex/RegexByteCode.cpp index 9005ac05848..6d190836a83 100644 --- a/Libraries/LibRegex/RegexByteCode.cpp +++ b/Libraries/LibRegex/RegexByteCode.cpp @@ -540,7 +540,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(MatchInput const& input, M return ExecutionResult::Failed_ExecuteLowPrioForks; auto count = m_bytecode->at(offset++); - auto range_data = m_bytecode->template spans<4>().slice(offset, count); + auto range_data = m_bytecode->flat_data().slice(offset, count); offset += count; auto ch = input.view[state.string_position_in_code_units];