Blob Blame History Raw
Index: mlpack-1.0.3/src/mlpack/core/arma_extend/traits.hpp
===================================================================
--- mlpack-1.0.3/src/mlpack/core/arma_extend/traits.hpp	(revision 13920)
+++ mlpack-1.0.3/src/mlpack/core/arma_extend/traits.hpp	(working copy)
@@ -15,7 +15,25 @@
 
 // This isn't necessary if Armadillo was compiled with 64-bit support.
 #ifndef ARMA_64BIT_WORD
+template<typename T1>
+struct is_u64
+  { static const bool value = false; };
+
 template<>
+struct is_u64<u64>
+  { static const bool value = true; };
+
+
+template<typename T1>
+struct is_s64
+  { static const bool value = false; };
+
+template<>
+struct is_s64<s64>
+  { static const bool value = true; };
+
+
+template<>
 struct is_supported_elem_type<u64>
   {
   static const bool value = true;
@@ -26,6 +44,13 @@
   {
   static const bool value = true;
   };
+
+
+template<>
+struct is_signed<u64>
+  {
+  static const bool value = false;
+  };
 #endif
 
 #endif
Index: mlpack-1.0.3/src/mlpack/core/arma_extend/restrictors.hpp
===================================================================
--- mlpack-1.0.3/src/mlpack/core/arma_extend/restrictors.hpp	(revision 0)
+++ mlpack-1.0.3/src/mlpack/core/arma_extend/restrictors.hpp	(working copy)
@@ -0,0 +1,17 @@
+// Modifications to allow u64/s64 in Armadillo when ARMA_64BIT_WORD is not
+// defined.
+#ifndef ARMA_64BIT_WORD
+
+template<> struct arma_scalar_only<u64>   { typedef u64   result; };
+template<> struct arma_scalar_only<s64>   { typedef s64   result; };
+
+template<> struct arma_integral_only<u64> { typedef u64   result; };
+template<> struct arma_integral_only<s64> { typedef s64   result; };
+
+template<> struct arma_unsigned_integral_only<u64> { typedef u64 result; };
+
+template<> struct arma_signed_integral_only<s64> { typedef s64 result; };
+
+template<> struct arma_signed_only<s64> { typedef s64 result; };
+
+#endif
Index: mlpack-1.0.3/src/mlpack/core/arma_extend/arma_extend.hpp
===================================================================
--- mlpack-1.0.3/src/mlpack/core/arma_extend/arma_extend.hpp	(revision 13920)
+++ mlpack-1.0.3/src/mlpack/core/arma_extend/arma_extend.hpp	(working copy)
@@ -21,10 +21,12 @@
 #endif
 
 namespace arma {
-  // u64
+  // u64/s64
   #include "typedef.hpp"
   #include "traits.hpp"
   #include "promote_type.hpp"
+  #include "restrictors.hpp"
+  #include "hdf5_misc.hpp"
 
   // ccov()
   #include "op_ccov_proto.hpp"
Index: mlpack-1.0.3/src/mlpack/core/arma_extend/typedef.hpp
===================================================================
--- mlpack-1.0.3/src/mlpack/core/arma_extend/typedef.hpp	(revision 13920)
+++ mlpack-1.0.3/src/mlpack/core/arma_extend/typedef.hpp	(working copy)
@@ -42,17 +42,28 @@
     #endif
     };
 
-  typedef deduce_u64<(sizeof(std::size_t) >= 8)>::u64 u64;
-#endif
-
   // We only need to typedef s64.
   #if   ULONG_MAX >= 0xffffffffffffffff
     typedef          long s64;
   #elif ULLONG_MAX >= 0xffffffffffffffff
-    typedef          long s64;
+    typedef     long long s64;
   #else
     #error "don't know how to typedef 's64' on this system"
   #endif
+
+  typedef deduce_u64<(sizeof(std::size_t) >= 8)>::u64 u64;
+
+  namespace junk
+    {
+    struct arma_64_elem_size_test
+      {
+      arma_static_check( (sizeof(u64) != 8), ERROR___TYPE_U64_HAS_UNSUPPORTED_SIZE );
+      arma_static_check( (sizeof(s64) != 8), ERROR___TYPE_S64_HAS_UNSUPPORTED_SIZE );
+      };
+    }
+
+#endif
+
 #else
 
   // We must typedef both u64 and s64.
Index: mlpack-1.0.3/src/mlpack/core/arma_extend/hdf5_misc.hpp
===================================================================
--- mlpack-1.0.3/src/mlpack/core/arma_extend/hdf5_misc.hpp	(revision 0)
+++ mlpack-1.0.3/src/mlpack/core/arma_extend/hdf5_misc.hpp	(working copy)
@@ -0,0 +1,21 @@
+// To hack in u64/s64 support to Armadillo when it is not compiled with
+// ARMA_64BIT_WORD.
+#ifdef ARMA_USE_HDF5
+
+template<>
+inline
+hid_t
+get_hdf5_type< long long >()
+  {
+  return H5Tcopy(H5T_NATIVE_LLONG);
+  }
+
+template<>
+inline
+hid_t
+get_hdf5_type< unsigned long long >()
+  {
+  return H5Tcopy(H5T_NATIVE_ULLONG);
+  }
+
+#endif