summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex/RegexOptimizer.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-07-05 04:56:21 +0430
committerAndreas Kling <kling@serenityos.org>2022-07-05 07:19:13 +0200
commit7d01ee63d65831a4d32a4184517f7cc6e68ee83c (patch)
tree99acc652421eccecae5325cea7cc01be8a3cb893 /Userland/Libraries/LibRegex/RegexOptimizer.cpp
parentc774790975f136bcff70dd4e9fa444f100f34003 (diff)
downloadserenity-7d01ee63d65831a4d32a4184517f7cc6e68ee83c.zip
LibRegex: Use proper CharRange constructor instead of bit_casting
Otherwise the range order would be inverted.
Diffstat (limited to 'Userland/Libraries/LibRegex/RegexOptimizer.cpp')
-rw-r--r--Userland/Libraries/LibRegex/RegexOptimizer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibRegex/RegexOptimizer.cpp b/Userland/Libraries/LibRegex/RegexOptimizer.cpp
index cc595798b1..78f7017f58 100644
--- a/Userland/Libraries/LibRegex/RegexOptimizer.cpp
+++ b/Userland/Libraries/LibRegex/RegexOptimizer.cpp
@@ -187,7 +187,7 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa
lhs_negated_char_classes.set(static_cast<CharClass>(pair.value));
break;
case CharacterCompareType::CharRange: {
- auto range = bit_cast<CharRange>(pair.value);
+ auto range = CharRange(pair.value);
if (!current_lhs_inversion_state())
lhs_ranges.insert(range.from, range.to);
else
@@ -257,7 +257,7 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa
return true;
break;
case CharacterCompareType::CharRange: {
- auto range = bit_cast<CharRange>(pair.value);
+ auto range = CharRange(pair.value);
if (!current_lhs_inversion_state() && range_contains(range))
return true;
break;