wide-int.h (wide_int_storage::operator=): Implement in terms of wi::copy.
authorRichard Biener <rguenther@suse.de>
Thu, 2 Mar 2017 08:02:41 +0000 (08:02 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 2 Mar 2017 08:02:41 +0000 (08:02 +0000)
2017-03-02  Richard Biener  <rguenther@suse.de>

* wide-int.h (wide_int_storage::operator=): Implement in terms
of wi::copy.

From-SVN: r245831

gcc/ChangeLog
gcc/wide-int.h

index 530acbb..5bd3094 100644 (file)
@@ -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.
index b660db2..2115b61 100644 (file)
@@ -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
 {