1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibSQL: Avoid signed arithmetic in IntegerImpl::compare

This commit is contained in:
Mahmoud Mandour 2021-11-08 22:29:36 +02:00 committed by Andreas Kling
parent a962ee020a
commit cd4dba87fa
Notes: sideshowbarker 2024-07-17 19:47:17 +09:00

View file

@ -704,10 +704,13 @@ bool IntegerImpl::can_cast(Value const& other_value)
int IntegerImpl::compare(Value const& other) const
{
auto casted = other.to_int();
if (!casted.has_value()) {
if (!casted.has_value())
return 1;
}
return value() - casted.value();
if (value() == casted.value())
return 0;
return value() < casted.value() ? -1 : 1;
}
u32 IntegerImpl::hash() const