From c8c6a29ecaee5c1ff4f287606813d1057c0931f9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 2 Mar 2017 08:02:41 +0000 Subject: [PATCH] wide-int.h (wide_int_storage::operator=): Implement in terms of wi::copy. 2017-03-02 Richard Biener * wide-int.h (wide_int_storage::operator=): Implement in terms of wi::copy. From-SVN: r245831 --- gcc/ChangeLog | 5 +++++ gcc/wide-int.h | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 530acbb9ba3..5bd3094e3aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-02 Richard Biener + + * wide-int.h (wide_int_storage::operator=): Implement in terms + of wi::copy. + 2017-03-02 Richard Biener PR tree-optimization/79777 diff --git a/gcc/wide-int.h b/gcc/wide-int.h index b660db2e0e9..2115b614a9f 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 + 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 +inline wide_int_storage& +wide_int_storage::operator = (const T &x) +{ + { STATIC_ASSERT (!wi::int_traits::host_dependent_precision); } + { STATIC_ASSERT (wi::int_traits::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 { -- 2.30.2