[eigen] GCC-4.6 compilation problem + patch

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi, all

First of all, thanks for the great library!

But working on package for Debian (gcc-4.6), I found that "make doc"
and "make check" are both failed.
The problem is in using in some places of the code "ptrdiff_t" instead
of "std::ptrdiff_t".

The patch is attached.

Thank you.

Anton Gladky
diff -r d84c8f4660e6 Eigen/src/Core/arch/AltiVec/Complex.h
--- a/Eigen/src/Core/arch/AltiVec/Complex.h	Wed May 04 14:28:45 2011 +0100
+++ b/Eigen/src/Core/arch/AltiVec/Complex.h	Wed May 04 23:21:40 2011 +0200
@@ -70,7 +70,7 @@
 {
   Packet2cf res;
   /* On AltiVec we cannot load 64-bit registers, so wa have to take care of alignment */
-  if((ptrdiff_t(&from) % 16) == 0)
+  if((std::ptrdiff_t(&from) % 16) == 0)
     res.v = pload<Packet4f>((const float *)&from);
   else
     res.v = ploadu<Packet4f>((const float *)&from);
diff -r d84c8f4660e6 Eigen/src/Core/arch/AltiVec/PacketMath.h
--- a/Eigen/src/Core/arch/AltiVec/PacketMath.h	Wed May 04 14:28:45 2011 +0100
+++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h	Wed May 04 23:21:40 2011 +0200
@@ -296,14 +296,14 @@
 template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float*   from)
 {
   Packet4f p;
-  if((ptrdiff_t(&from) % 16) == 0)  p = pload<Packet4f>(from);
+  if((std::ptrdiff_t(&from) % 16) == 0)  p = pload<Packet4f>(from);
   else                              p = ploadu<Packet4f>(from);
   return vec_perm(p, p, p16uc_DUPLICATE);
 }
 template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int*     from)
 {
   Packet4i p;
-  if((ptrdiff_t(&from) % 16) == 0)  p = pload<Packet4i>(from);
+  if((std::ptrdiff_t(&from) % 16) == 0)  p = pload<Packet4i>(from);
   else                              p = ploadu<Packet4i>(from);
   return vec_perm(p, p, p16uc_DUPLICATE);
 }
diff -r d84c8f4660e6 Eigen/src/StlSupport/details.h
--- a/Eigen/src/StlSupport/details.h	Wed May 04 14:28:45 2011 +0100
+++ b/Eigen/src/StlSupport/details.h	Wed May 04 23:21:40 2011 +0200
@@ -38,7 +38,7 @@
   {
   public:
     typedef size_t    size_type;
-    typedef ptrdiff_t difference_type;
+    typedef std::ptrdiff_t difference_type;
     typedef T*        pointer;
     typedef const T*  const_pointer;
     typedef T&        reference;
diff -r d84c8f4660e6 test/mapstride.cpp
--- a/test/mapstride.cpp	Wed May 04 14:28:45 2011 +0100
+++ b/test/mapstride.cpp	Wed May 04 23:21:40 2011 +0200
@@ -38,7 +38,7 @@
   Scalar* a_array = internal::aligned_new<Scalar>(arraysize+1);
   Scalar* array = a_array;
   if(Alignment!=Aligned)
-    array = (Scalar*)(ptrdiff_t(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
+    array = (Scalar*)(std::ptrdiff_t(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
 
   {
     Map<VectorType, Alignment, InnerStride<3> > map(array, size);
@@ -77,7 +77,7 @@
   Scalar* a_array = internal::aligned_new<Scalar>(arraysize+1);
   Scalar* array = a_array;
   if(Alignment!=Aligned)
-    array = (Scalar*)(ptrdiff_t(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
+    array = (Scalar*)(std::ptrdiff_t(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
 
   // test no inner stride and some dynamic outer stride
   {
diff -r d84c8f4660e6 unsupported/Eigen/FFT
--- a/unsupported/Eigen/FFT	Wed May 04 14:28:45 2011 +0100
+++ b/unsupported/Eigen/FFT	Wed May 04 23:21:40 2011 +0200
@@ -393,7 +393,7 @@
       for (int k=0;k<nx;++k)
         *x++ *= s;
 #else
-      if ( ((ptrdiff_t)x) & 15 )
+      if ( ((std::ptrdiff_t)x) & 15 )
         Matrix<T_Data, Dynamic, 1>::Map(x,nx) *= s;
       else
         Matrix<T_Data, Dynamic, 1>::MapAligned(x,nx) *= s;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/