diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-03-30 13:17:03 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-03-30 13:17:03 -0700 |
commit | 1b40abbf99d2022d1167063f7e52126cbe8d76bd (patch) | |
tree | 048f36ddd717a2e16b70fd14e1d52db2848068a6 /unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h | |
parent | 01b5333e44eea55f1dfc5edd7ec8ffec866d64ca (diff) |
Added missing assignment operator to the TensorUInt128 class, and made misc small improvements
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h b/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h index 02d6646d8..543a444fb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h @@ -40,14 +40,25 @@ struct TensorUInt128 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> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE explicit TensorUInt128(const T& x) : high(0), low(x) { + eigen_assert(x < NumTraits<LOW>::highest()); eigen_assert(x >= 0); } 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 { return low; |