Add missing compound assignment operators. (#1216)

[ROCm/clr commit: e701e337f9]
This commit is contained in:
mhbliao
2019-07-11 05:16:15 -04:00
committed by Maneesh Gupta
orang tua 877fd02244
melakukan e402a1db65
@@ -294,6 +294,7 @@ THE SOFTWARE.
++*this;
return tmp;
}
inline __host__ __device__
HIP_vector_type& operator--() noexcept
{
@@ -306,12 +307,23 @@ THE SOFTWARE.
--*this;
return tmp;
}
inline __host__ __device__
HIP_vector_type& operator+=(const HIP_vector_type& x) noexcept
{
data += x.data;
return *this;
}
template<
typename U,
typename std::enable_if<
std::is_convertible<U, T>{}>::type* = nullptr>
inline __host__ __device__
HIP_vector_type& operator+=(U x) noexcept
{
return *this += HIP_vector_type{x};
}
inline __host__ __device__
HIP_vector_type& operator-=(const HIP_vector_type& x) noexcept
{
@@ -327,18 +339,38 @@ THE SOFTWARE.
{
return *this -= HIP_vector_type{x};
}
inline __host__ __device__
HIP_vector_type& operator*=(const HIP_vector_type& x) noexcept
{
data *= x.data;
return *this;
}
template<
typename U,
typename std::enable_if<
std::is_convertible<U, T>{}>::type* = nullptr>
inline __host__ __device__
HIP_vector_type& operator*=(U x) noexcept
{
return *this *= HIP_vector_type{x};
}
inline __host__ __device__
HIP_vector_type& operator/=(const HIP_vector_type& x) noexcept
{
data /= x.data;
return *this;
}
template<
typename U,
typename std::enable_if<
std::is_convertible<U, T>{}>::type* = nullptr>
inline __host__ __device__
HIP_vector_type& operator/=(U x) noexcept
{
return *this /= HIP_vector_type{x};
}
template<
typename U = T,
@@ -361,6 +393,7 @@ THE SOFTWARE.
r.data = ~r.data;
return r;
}
template<
typename U = T,
typename std::enable_if<std::is_integral<U>{}>::type* = nullptr>
@@ -370,6 +403,7 @@ THE SOFTWARE.
data %= x.data;
return *this;
}
template<
typename U = T,
typename std::enable_if<std::is_integral<U>{}>::type* = nullptr>
@@ -379,6 +413,7 @@ THE SOFTWARE.
data ^= x.data;
return *this;
}
template<
typename U = T,
typename std::enable_if<std::is_integral<U>{}>::type* = nullptr>
@@ -388,6 +423,7 @@ THE SOFTWARE.
data |= x.data;
return *this;
}
template<
typename U = T,
typename std::enable_if<std::is_integral<U>{}>::type* = nullptr>
@@ -397,6 +433,7 @@ THE SOFTWARE.
data &= x.data;
return *this;
}
template<
typename U = T,
typename std::enable_if<std::is_integral<U>{}>::type* = nullptr>
@@ -406,6 +443,7 @@ THE SOFTWARE.
data >>= x.data;
return *this;
}
template<
typename U = T,
typename std::enable_if<std::is_integral<U>{}>::type* = nullptr>