Add missing compound assignment operators. (#1216)
Этот коммит содержится в:
коммит произвёл
Maneesh Gupta
родитель
46553d719a
Коммит
e701e337f9
@@ -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>
|
||||
|
||||
Ссылка в новой задаче
Block a user