aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-03-02 08:02:41 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-03-02 08:02:41 +0000
commitc8c6a29ecaee5c1ff4f287606813d1057c0931f9 (patch)
tree0afe675d39c1f3032d680a6d67fdce250ae5a52d
parent83692f96622d65acd462df4cea225b7bc2827d80 (diff)
downloadgcc-c8c6a29ecaee5c1ff4f287606813d1057c0931f9.zip
gcc-c8c6a29ecaee5c1ff4f287606813d1057c0931f9.tar.gz
gcc-c8c6a29ecaee5c1ff4f287606813d1057c0931f9.tar.bz2
wide-int.h (wide_int_storage::operator=): Implement in terms of wi::copy.
2017-03-02 Richard Biener <rguenther@suse.de> * wide-int.h (wide_int_storage::operator=): Implement in terms of wi::copy. From-SVN: r245831
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/wide-int.h15
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 530acbb..5bd3094 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-03-02 Richard Biener <rguenther@suse.de>
+ * wide-int.h (wide_int_storage::operator=): Implement in terms
+ of wi::copy.
+
+2017-03-02 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/79777
* tree-ssa-pre.c (eliminate_insert): Give up if we simplify
the to insert expression to sth existing.
diff --git a/gcc/wide-int.h b/gcc/wide-int.h
index b660db2..2115b61 100644
--- a/gcc/wide-int.h
+++ b/gcc/wide-int.h
@@ -1019,6 +1019,9 @@ public:
HOST_WIDE_INT *write_val ();
void set_len (unsigned int, bool = false);
+ template <typename T>
+ wide_int_storage &operator = (const T &);
+
static wide_int from (const wide_int_ref &, unsigned int, signop);
static wide_int from_array (const HOST_WIDE_INT *, unsigned int,
unsigned int, bool = true);
@@ -1058,6 +1061,18 @@ inline wide_int_storage::wide_int_storage (const T &x)
wi::copy (*this, xi);
}
+template <typename T>
+inline wide_int_storage&
+wide_int_storage::operator = (const T &x)
+{
+ { STATIC_ASSERT (!wi::int_traits<T>::host_dependent_precision); }
+ { STATIC_ASSERT (wi::int_traits<T>::precision_type != wi::CONST_PRECISION); }
+ WIDE_INT_REF_FOR (T) xi (x);
+ precision = xi.precision;
+ wi::copy (*this, xi);
+ return *this;
+}
+
inline unsigned int
wide_int_storage::get_precision () const
{