From: Ian S. <sc...@im...> - 2011-04-01 13:38:41
|
On 31/03/2011 16:53, Laflen, Brandon (GE Global Research) wrote: > Dear vxl-users, > > I am having difficulty compiling 64-bit code that uses the "long long" > data type. The problem appears to be arising from insufficient support > either in vcl or vnl. This problem occurs on a 64-bit Windows 7 > platform, with Visual Studio 2010. > > I have posted a generic example of the issue below. Is this a problem > with vxl support for VS2010, or vxl support for "long long" in general? VXL support for long long is not complete. VNL appears to be a particular problem. I think vil support for long long on MSVC is fairly complete (vxl_int_64 is a typedef for long long) It isn't that hard to add locally. I'd added some of the missing stuff in a few minutes ... see below. It may be trickier to add it properly to VNL in a good enough form to commit, since the code will have to handle different compilers where long long is a distinct type from long, vxl_int_64 on all relevent compilers. (bear in mind that long long is a C99 or C++0x feature, and not a part of the C++98 standard) Ian. Add to vnl_numeric_limits.h > > VCL_DEFINE_SPECIALIZATION > class vnl_numeric_traits<long long> > { > public: > //: Additive identity > static const long long zero VCL_STATIC_CONST_INIT_INT_DECL(0); > //: Multiplicative identity > static const long long one VCL_STATIC_CONST_INIT_INT_DECL(1); > //: Maximum value which this type can assume > static const long long maxval; // = 0x7fffffff; > //: Return value of abs() > typedef long long abs_t; > //: Name of a type twice as long as this one for accumulators and products. > typedef long long double_t; > //: Name of type which results from multiplying this type with a double > typedef double real_t; > }; > > #if !VCL_CANNOT_SPECIALIZE_CV > VCL_DEFINE_SPECIALIZATION > class vnl_numeric_traits<long long const> : public vnl_numeric_traits<long long> {}; > #endif Add to vnl_numeric_traits.cxx > const long long vnl_numeric_traits<long long>::maxval = sizeof(long long)==(vxl_uint_64)(-1); > Add to vnl_complex_traits.cxx > VCL_DEFINE_SPECIALIZATION struct vnl_complex_traits<long long> > { > enum { isreal = true }; > static long long conjugate(long long x) { return x; } > static vcl_complex<long long> complexify(long long x) { return vcl_complex<long long >(x, (long long)0); } > }; > > Add to vnl_math.h > inline long long vnl_math_squared_magnitude(long long x) { return x*x; } Add to vnl_c_vector+long_long-.cxx > #include <vnl/vnl_c_vector.txx> > > VNL_C_VECTOR_INSTANTIATE_ordered(long long); |