]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/double-int.c
Modify gcc/*.[hc] double_int call sites to use the new interface.
[thirdparty/gcc.git] / gcc / double-int.c
index 3a22d15f08cd72390c7cb72ee80665e709f86d6b..f3d5e8b3dde97067a0af9ce41a854115a133f5b3 100644 (file)
@@ -606,7 +606,6 @@ div_and_round_double (unsigned code, int uns,
   return overflow;
 }
 
-
 /* Returns mask for PREC bits.  */
 
 double_int
@@ -754,7 +753,7 @@ double_int::operator * (double_int b) const
    *OVERFLOW is set to nonzero.  */
 
 double_int
-double_int::mul_with_sign (double_int b, bool unsigned_p, int *overflow) const
+double_int::mul_with_sign (double_int b, bool unsigned_p, bool *overflow) const
 {
   const double_int &a = *this;
   double_int ret;
@@ -774,6 +773,19 @@ double_int::operator + (double_int b) const
   return ret;
 }
 
+/* Returns A + B. If the operation overflows according to UNSIGNED_P,
+   *OVERFLOW is set to nonzero.  */
+
+double_int
+double_int::add_with_sign (double_int b, bool unsigned_p, bool *overflow) const
+{
+  const double_int &a = *this;
+  double_int ret;
+  *overflow = add_double_with_sign (a.low, a.high, b.low, b.high,
+                                    &ret.low, &ret.high, unsigned_p);
+  return ret;
+}
+
 /* Returns A - B.  */
 
 double_int
@@ -1104,6 +1116,20 @@ double_int::ult (double_int b) const
   return false;
 }
 
+/* Compares two unsigned values A and B for less-than or equal-to.  */
+
+bool
+double_int::ule (double_int b) const
+{
+  if ((unsigned HOST_WIDE_INT) high < (unsigned HOST_WIDE_INT) b.high)
+    return true;
+  if ((unsigned HOST_WIDE_INT) high > (unsigned HOST_WIDE_INT) b.high)
+    return false;
+  if (low <= b.low)
+    return true;
+  return false;
+}
+
 /* Compares two unsigned values A and B for greater-than.  */
 
 bool
@@ -1132,6 +1158,20 @@ double_int::slt (double_int b) const
   return false;
 }
 
+/* Compares two signed values A and B for less-than or equal-to.  */
+
+bool
+double_int::sle (double_int b) const
+{
+  if (high < b.high)
+    return true;
+  if (high > b.high)
+    return false;
+  if (low <= b.low)
+    return true;
+  return false;
+}
+
 /* Compares two signed values A and B for greater-than.  */
 
 bool