[Rcpp-commits] r3264 - in pkg/Rcpp/inst: include/Rcpp/traits unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 2 11:23:08 CET 2011


Author: romain
Date: 2011-11-02 11:23:08 +0100 (Wed, 02 Nov 2011)
New Revision: 3264

Modified:
   pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h
   pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h
   pkg/Rcpp/inst/unitTests/runit.macros.R
Log:
trying to fix pb reported by doug

Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h	2011-11-02 05:53:46 UTC (rev 3263)
+++ pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h	2011-11-02 10:23:08 UTC (rev 3264)
@@ -124,12 +124,12 @@
 template<> struct r_type_traits< std::pair<const std::string,std::complex<float> > >{ typedef r_type_primitive_tag r_category ; } ;
 
 /* long long int */
-#ifdef RCPP_HAS_LONG_LONG_TYPES
-template<> struct r_type_traits<rcpp_long_long_type>{ typedef r_type_primitive_tag r_category ; } ;
-template<> struct r_type_traits< std::pair<const std::string,rcpp_long_long_type> >{ typedef r_type_primitive_tag r_category ; } ;
-template<> struct r_type_traits<rcpp_ulong_long_type>{ typedef r_type_primitive_tag r_category ; } ;
-template<> struct r_type_traits< std::pair<const std::string,rcpp_ulong_long_type> >{ typedef r_type_primitive_tag r_category ; } ;
-#endif
+// #ifdef RCPP_HAS_LONG_LONG_TYPES
+// template<> struct r_type_traits<rcpp_long_long_type>{ typedef r_type_primitive_tag r_category ; } ;
+// template<> struct r_type_traits< std::pair<const std::string,rcpp_long_long_type> >{ typedef r_type_primitive_tag r_category ; } ;
+// template<> struct r_type_traits<rcpp_ulong_long_type>{ typedef r_type_primitive_tag r_category ; } ;
+// template<> struct r_type_traits< std::pair<const std::string,rcpp_ulong_long_type> >{ typedef r_type_primitive_tag r_category ; } ;
+// #endif
 
 template<> struct r_type_traits<int64_t>{ typedef r_type_int64_tag r_category; } ;
 template<> struct r_type_traits<uint64_t>{ typedef r_type_int64_tag r_category ; } ;

Modified: pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h	2011-11-02 05:53:46 UTC (rev 3263)
+++ pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h	2011-11-02 10:23:08 UTC (rev 3264)
@@ -70,18 +70,24 @@
 template <> struct wrap_type_traits< std::complex<float> > { typedef wrap_type_primitive_tag wrap_category; } ;
 template <> struct wrap_type_traits< std::complex<double> > { typedef wrap_type_primitive_tag wrap_category; } ;
 
-template <> struct wrap_type_traits<long> { typedef wrap_type_primitive_tag wrap_category; } ;
-template <> struct wrap_type_traits<unsigned long> { typedef wrap_type_primitive_tag wrap_category; } ;
+// FIXME : sometimes long = int64_t
+template <> struct wrap_type_traits<long> { 
+	typedef wrap_type_primitive_tag wrap_category;
+} ;
+template <> struct wrap_type_traits<unsigned long> {
+	typedef wrap_type_primitive_tag wrap_category;
+} ;
 
 template <> struct wrap_type_traits<long double> { typedef wrap_type_primitive_tag wrap_category; } ;
 
 template <> struct wrap_type_traits<short> { typedef wrap_type_primitive_tag wrap_category; } ;
 template <> struct wrap_type_traits<unsigned short> { typedef wrap_type_primitive_tag wrap_category; } ;
 
-#ifdef RCPP_HAS_LONG_LONG_TYPES
-template <> struct wrap_type_traits<rcpp_long_long_type> { typedef wrap_type_primitive_tag wrap_category; } ;
-template <> struct wrap_type_traits<rcpp_ulong_long_type> { typedef wrap_type_primitive_tag wrap_category; } ;
-#endif
+// #ifdef RCPP_HAS_LONG_LONG_TYPES
+// [romain] : don't think we need this anymore as we deal with int64_t and uint64_t below
+// template <> struct wrap_type_traits<rcpp_long_long_type> { typedef wrap_type_primitive_tag wrap_category; } ;
+// template <> struct wrap_type_traits<rcpp_ulong_long_type> { typedef wrap_type_primitive_tag wrap_category; } ;
+// #endif
 
 template <> struct wrap_type_traits<int64_t> { typedef wrap_type_int64_tag wrap_category; } ;
 template <> struct wrap_type_traits<uint64_t> { typedef wrap_type_int64_tag wrap_category; } ;

Modified: pkg/Rcpp/inst/unitTests/runit.macros.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.macros.R	2011-11-02 05:53:46 UTC (rev 3263)
+++ pkg/Rcpp/inst/unitTests/runit.macros.R	2011-11-02 10:23:08 UTC (rev 3264)
@@ -223,12 +223,12 @@
 	fx <- cxxfunction( signature(), '
 		return foo() ;
 	', includes = '
-	RCPP_FUNCTION_0(size_t, foo){
-		std::vector<int> v(10) ;
-		return v.size() ;
+	RCPP_FUNCTION_0(int64_t, foo){
+		int64_t x = 1234 ;
+		return x ;
 	}
 	', plugin = "Rcpp" )
-	checkEquals( as.integer(fx()), 10L, msg = "long long support" )
+	checkEquals( fx(), as.int64(1234L), msg = "long long support" )
 
 }
 



More information about the Rcpp-commits mailing list