summaryrefslogtreecommitdiff
path: root/system/framework/decimal/comparison-with-nan.patch
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2021-11-23 04:27:32 -0500
committerMatt A. Tobin <email@mattatobin.com>2021-11-23 04:27:32 -0500
commit91ce8b18174dcff3eeba770bd280eb5af0df98ca (patch)
tree822ec21cffe148c35d3ea389c920ea0e2d4e06c7 /system/framework/decimal/comparison-with-nan.patch
parent96e1a7d23192af51d38dbd7a243e89ce4ef6dd8b (diff)
downloadaura-central-91ce8b18174dcff3eeba770bd280eb5af0df98ca.tar.gz
Issue %3005 - Move memory/mfbt/mozglue to system/ as memory, framework, and utils respectively
Diffstat (limited to 'system/framework/decimal/comparison-with-nan.patch')
-rw-r--r--system/framework/decimal/comparison-with-nan.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/system/framework/decimal/comparison-with-nan.patch b/system/framework/decimal/comparison-with-nan.patch
new file mode 100644
index 000000000..477a61437
--- /dev/null
+++ b/system/framework/decimal/comparison-with-nan.patch
@@ -0,0 +1,67 @@
+diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
+--- a/mfbt/decimal/Decimal.cpp
++++ b/mfbt/decimal/Decimal.cpp
+@@ -509,21 +509,25 @@ Decimal Decimal::operator/(const Decimal
+ if (remainder > divisor / 2)
+ ++result;
+
+ return Decimal(resultSign, resultExponent, result);
+ }
+
+ bool Decimal::operator==(const Decimal& rhs) const
+ {
++ if (isNaN() || rhs.isNaN())
++ return false;
+ return m_data == rhs.m_data || compareTo(rhs).isZero();
+ }
+
+ bool Decimal::operator!=(const Decimal& rhs) const
+ {
++ if (isNaN() || rhs.isNaN())
++ return true;
+ if (m_data == rhs.m_data)
+ return false;
+ const Decimal result = compareTo(rhs);
+ if (result.isNaN())
+ return false;
+ return !result.isZero();
+ }
+
+@@ -532,16 +536,18 @@ bool Decimal::operator<(const Decimal& r
+ const Decimal result = compareTo(rhs);
+ if (result.isNaN())
+ return false;
+ return !result.isZero() && result.isNegative();
+ }
+
+ bool Decimal::operator<=(const Decimal& rhs) const
+ {
++ if (isNaN() || rhs.isNaN())
++ return false;
+ if (m_data == rhs.m_data)
+ return true;
+ const Decimal result = compareTo(rhs);
+ if (result.isNaN())
+ return false;
+ return result.isZero() || result.isNegative();
+ }
+
+@@ -550,16 +556,18 @@ bool Decimal::operator>(const Decimal& r
+ const Decimal result = compareTo(rhs);
+ if (result.isNaN())
+ return false;
+ return !result.isZero() && result.isPositive();
+ }
+
+ bool Decimal::operator>=(const Decimal& rhs) const
+ {
++ if (isNaN() || rhs.isNaN())
++ return false;
+ if (m_data == rhs.m_data)
+ return true;
+ const Decimal result = compareTo(rhs);
+ if (result.isNaN())
+ return false;
+ return result.isZero() || !result.isNegative();
+ }
+