aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/util/IntegralConstant.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2017-01-24 10:53:51 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2017-01-24 10:53:51 +0100
commit228fef1b3ac3f635b5d7b7546a1c8bd0dd4c57be (patch)
treea5e92ea71ff1a9ad97faa25bb1e5001e78bda9c6 /Eigen/src/Core/util/IntegralConstant.h
parentbb52f74e6290cb0f84202866a27aa9c4c1ec9fc9 (diff)
Extended the set of arithmetic operators supported by FixedInt (-,+,*,/,%,&,|)
Diffstat (limited to 'Eigen/src/Core/util/IntegralConstant.h')
-rw-r--r--Eigen/src/Core/util/IntegralConstant.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/Eigen/src/Core/util/IntegralConstant.h b/Eigen/src/Core/util/IntegralConstant.h
index b25601ed3..f7baf1060 100644
--- a/Eigen/src/Core/util/IntegralConstant.h
+++ b/Eigen/src/Core/util/IntegralConstant.h
@@ -26,7 +26,7 @@ template<int N> class VariableAndFixedInt;
* It is similar to c++11 std::integral_constant<int,N> but with some additional features
* such as:
* - implicit conversion to int
- * - arithmetic operators: -, +, *
+ * - arithmetic and some bitwise operators: -, +, *, /, %, &, |
* - c++98/14 compatibility with fix<N> and fix<N>() syntax to define integral constants.
*
* It is strongly discouraged to directly deal with this class FixedInt. Instances are expcected to
@@ -64,6 +64,16 @@ public:
FixedInt<N+M> operator+( FixedInt<M>) const { return FixedInt<N+M>(); }
template<int M>
FixedInt<N-M> operator-( FixedInt<M>) const { return FixedInt<N-M>(); }
+ template<int M>
+ FixedInt<N*M> operator*( FixedInt<M>) const { return FixedInt<N*M>(); }
+ template<int M>
+ FixedInt<N/M> operator/( FixedInt<M>) const { return FixedInt<N/M>(); }
+ template<int M>
+ FixedInt<N%M> operator%( FixedInt<M>) const { return FixedInt<N%M>(); }
+ template<int M>
+ FixedInt<N|M> operator|( FixedInt<M>) const { return FixedInt<N|M>(); }
+ template<int M>
+ FixedInt<N&M> operator&( FixedInt<M>) const { return FixedInt<N&M>(); }
#if EIGEN_HAS_CXX14
// Needed in C++14 to allow fix<N>():