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 530acbb9ba31d66ad2eb1797a1b98699bb4bdea5..5bd3094e3aa988ec4757710607d5bc306c15a09d 100644 (file)
@@ -1,3 +1,8 @@
+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
index b660db2e0e90bebf64bc3cd62dfb4fc6198804a6..2115b614a9f84eb23964f9a1c0a9fc0775955d2c 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
 {