mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Added missing assignment operator to the TensorUInt128 class, and made misc small improvements
This commit is contained in:
parent
01b5333e44
commit
1b40abbf99
@ -40,14 +40,25 @@ struct TensorUInt128
|
|||||||
EIGEN_STATIC_ASSERT(sizeof(OTHER_LOW) <= sizeof(LOW), YOU_MADE_A_PROGRAMMING_MISTAKE);
|
EIGEN_STATIC_ASSERT(sizeof(OTHER_LOW) <= sizeof(LOW), YOU_MADE_A_PROGRAMMING_MISTAKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename OTHER_HIGH, typename OTHER_LOW>
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
||||||
|
TensorUInt128& operator = (const TensorUInt128<OTHER_HIGH, OTHER_LOW>& other) {
|
||||||
|
EIGEN_STATIC_ASSERT(sizeof(OTHER_HIGH) <= sizeof(HIGH), YOU_MADE_A_PROGRAMMING_MISTAKE);
|
||||||
|
EIGEN_STATIC_ASSERT(sizeof(OTHER_LOW) <= sizeof(LOW), YOU_MADE_A_PROGRAMMING_MISTAKE);
|
||||||
|
high = other.high;
|
||||||
|
low = other.low;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
||||||
explicit TensorUInt128(const T& x) : high(0), low(x) {
|
explicit TensorUInt128(const T& x) : high(0), low(x) {
|
||||||
|
eigen_assert(x < NumTraits<LOW>::highest());
|
||||||
eigen_assert(x >= 0);
|
eigen_assert(x >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
||||||
TensorUInt128(uint64_t y, uint64_t x) : high(y), low(x) { }
|
TensorUInt128(HIGH y, LOW x) : high(y), low(x) { }
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE operator LOW() const {
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE operator LOW() const {
|
||||||
return low;
|
return low;
|
||||||
|
@ -147,7 +147,7 @@ void test_misc2() {
|
|||||||
void test_cxx11_tensor_uint128()
|
void test_cxx11_tensor_uint128()
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_NO_INT128
|
#ifdef EIGEN_NO_INT128
|
||||||
// Skip the test on compilers that don't support 128bit integers natively
|
// Skip the test on compilers that don't support 128bit integers natively
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
CALL_SUBTEST_1(test_add());
|
CALL_SUBTEST_1(test_add());
|
||||||
|
Loading…
Reference in New Issue
Block a user