summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-02 17:49:02 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-02 18:32:56 +0200
commit87290e300eae8cdad244a034dbd574077f0b169e (patch)
treef29c4286d6e28b9390dbb04773ffebd0c834bfd8
parentf0b3a06746aec51ef43366f73bdb766673157c48 (diff)
downloadserenity-87290e300eae8cdad244a034dbd574077f0b169e.zip
AK: Simplify Utf16View::operator==(Utf16View)
-rw-r--r--AK/Utf16View.cpp15
-rw-r--r--AK/Utf16View.h2
2 files changed, 1 insertions, 16 deletions
diff --git a/AK/Utf16View.cpp b/AK/Utf16View.cpp
index fcac008c01..09cd06cf16 100644
--- a/AK/Utf16View.cpp
+++ b/AK/Utf16View.cpp
@@ -224,21 +224,6 @@ size_t Utf16View::calculate_length_in_code_points() const
return code_points;
}
-bool Utf16View::operator==(Utf16View const& other) const
-{
- if (length_in_code_units() == 0)
- return other.length_in_code_units() == 0;
- if (length_in_code_units() != other.length_in_code_units())
- return false;
-
- for (size_t i = 0; i < length_in_code_units(); ++i) {
- if (m_code_units[i] != other.m_code_units[i])
- return false;
- }
-
- return true;
-}
-
bool Utf16View::equals_ignoring_case(Utf16View const& other) const
{
if (length_in_code_units() == 0)
diff --git a/AK/Utf16View.h b/AK/Utf16View.h
index 805ab08000..348ef085e8 100644
--- a/AK/Utf16View.h
+++ b/AK/Utf16View.h
@@ -70,7 +70,7 @@ public:
{
}
- bool operator==(Utf16View const& other) const;
+ bool operator==(Utf16View const& other) const { return m_code_units == other.m_code_units; }
enum class AllowInvalidCodeUnits {
Yes,