[Rcpp-commits] r3390 - in pkg/int64: inst/include/int64 src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 19 10:36:30 CET 2011
Author: romain
Date: 2011-11-19 10:36:30 +0100 (Sat, 19 Nov 2011)
New Revision: 3390
Modified:
pkg/int64/inst/include/int64/LongVector.h
pkg/int64/inst/include/int64/arith.h
pkg/int64/inst/include/int64/as_character.h
pkg/int64/inst/include/int64/as_long.h
pkg/int64/inst/include/int64/compare.h
pkg/int64/inst/include/int64/format_binary.h
pkg/int64/inst/include/int64/get_bits.h
pkg/int64/inst/include/int64/get_class.h
pkg/int64/inst/include/int64/get_long.h
pkg/int64/inst/include/int64/int2.h
pkg/int64/inst/include/int64/int64.h
pkg/int64/inst/include/int64/long_traits.h
pkg/int64/inst/include/int64/math.h
pkg/int64/inst/include/int64/read_string.h
pkg/int64/inst/include/int64/read_string_forward.h
pkg/int64/inst/include/int64/summary.h
pkg/int64/src/int64.cpp
Log:
s/int64/Rint64/ as per Murray's request
Modified: pkg/int64/inst/include/int64/LongVector.h
===================================================================
--- pkg/int64/inst/include/int64/LongVector.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/LongVector.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -26,7 +26,7 @@
#include <vector>
#include <algorithm>
-namespace int64{
+namespace Rint64{
template <class LONG>
class LongVector : public internal::long_traits<LONG> {
@@ -50,14 +50,14 @@
int* p_i_x = INTEGER(x) ;
for( int i=0; i<n; i++){
if( p_i_x[i] == NA_INTEGER){
- SET_VECTOR_ELT( y, i, int64::internal::int2(
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(
na_hb() , na_lb()
) ) ;
} else {
tmp = (LONG) p_i_x[i] ;
hb = internal::get_high_bits<LONG>(tmp) ;
lb = internal::get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, int64::internal::int2(hb,lb) ) ;
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(hb,lb) ) ;
}
}
UNPROTECT(1) ; // y
@@ -74,14 +74,14 @@
int* p_i_x = INTEGER(x) ;
for( int i=0; i<n; i++){
if( p_i_x[i] == NA_INTEGER){
- SET_VECTOR_ELT( y, i, int64::internal::int2(
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(
na_hb(), na_lb()
) ) ;
} else {
tmp = (LONG) p_i_x[i] ;
hb = internal::get_high_bits<LONG>(tmp) ;
lb = internal::get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, int64::internal::int2(hb,lb) ) ;
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(hb,lb) ) ;
}
}
UNPROTECT(1) ; // y
@@ -98,14 +98,14 @@
double* p_d_x = REAL(x) ;
for( int i=0; i<n; i++){
if( R_IsNA(p_d_x[i]) ){
- SET_VECTOR_ELT( y, i, int64::internal::int2(
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(
na_hb(), na_lb()
) ) ;
} else {
tmp = (LONG) p_d_x[i] ;
hb = internal::get_high_bits<LONG>(tmp) ;
lb = internal::get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, int64::internal::int2(hb,lb) ) ;
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(hb,lb) ) ;
}
}
UNPROTECT(1) ; // y
@@ -116,26 +116,26 @@
case STRSXP:
{
int n = Rf_length(x) ;
- int64::internal::int64_naflag = false ;
+ Rint64::internal::int64_naflag = false ;
SEXP y = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
int hb, lb ;
LONG tmp ;
for( int i=0; i<n; i++){
if( !strncmp("NA", CHAR(STRING_ELT(x,i)) , 2) ){
- SET_VECTOR_ELT( y, i, int64::internal::int2(
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(
na_hb(), na_lb()
) ) ;
} else{
tmp = internal::read_string<LONG>( CHAR(STRING_ELT(x,i)) ) ;
hb = internal::get_high_bits<LONG>(tmp) ;
lb = internal::get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, int64::internal::int2(hb,lb) ) ;
+ SET_VECTOR_ELT( y, i, Rint64::internal::int2(hb,lb) ) ;
}
}
UNPROTECT(1) ; // y
data = y ;
R_PreserveObject(data) ;
- if( int64::internal::int64_naflag ) {
+ if( Rint64::internal::int64_naflag ) {
Rf_warning( "NA introduced by overflow" ) ;
}
break ;
@@ -149,7 +149,7 @@
}
operator SEXP(){
- std::string klass = int64::internal::get_class<LONG>() ;
+ std::string klass = Rint64::internal::get_class<LONG>() ;
SEXP res = PROTECT(
R_do_slot_assign(
R_do_new_object( R_do_MAKE_CLASS( klass.c_str() ) ),
@@ -162,7 +162,7 @@
LongVector(int n) : data(R_NilValue) {
SEXP x = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
for( int i=0; i<n; i++){
- SET_VECTOR_ELT( x, i, int64::internal::int2(0,0) ) ;
+ SET_VECTOR_ELT( x, i, Rint64::internal::int2(0,0) ) ;
}
UNPROTECT(1) ; // x
data = x ;
@@ -174,7 +174,7 @@
int hb = internal::get_high_bits<LONG>( value ) ;
int lb = internal::get_low_bits<LONG>( value ) ;
for( int i=0; i<n; i++){
- SET_VECTOR_ELT( x, i, int64::internal::int2(hb,lb) ) ;
+ SET_VECTOR_ELT( x, i, Rint64::internal::int2(hb,lb) ) ;
}
UNPROTECT(1) ; // x
data = x ;
@@ -186,9 +186,9 @@
SEXP x = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
int hb, lb ;
for( int i=0; i<n; i++, ++start){
- hb = int64::internal::get_high_bits<LONG>(*start) ;
- lb = int64::internal::get_low_bits<LONG>(*start) ;
- SET_VECTOR_ELT( x, i, int64::internal::int2(hb,lb) ) ;
+ hb = Rint64::internal::get_high_bits<LONG>(*start) ;
+ lb = Rint64::internal::get_low_bits<LONG>(*start) ;
+ SET_VECTOR_ELT( x, i, Rint64::internal::int2(hb,lb) ) ;
}
UNPROTECT(1) ; // x
data = x ;
@@ -202,13 +202,13 @@
inline LONG get(int i) const {
int* p = INTEGER(VECTOR_ELT(data,i)) ;
- return int64::internal::get_long<LONG>( p[0], p[1] ) ;
+ return Rint64::internal::get_long<LONG>( p[0], p[1] ) ;
}
inline void set(int i, LONG x){
int* p = INTEGER(VECTOR_ELT(data,i)) ;
- p[0] = int64::internal::get_high_bits(x) ;
- p[1] = int64::internal::get_low_bits(x) ;
+ p[0] = Rint64::internal::get_high_bits(x) ;
+ p[1] = Rint64::internal::get_low_bits(x) ;
}
inline int size() const { return Rf_length(data); }
Modified: pkg/int64/inst/include/int64/arith.h
===================================================================
--- pkg/int64/inst/include/int64/arith.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/arith.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -28,11 +28,11 @@
# define GOODIPROD(x, y, z) ((long double) (x) * (long double) (y) == (z))
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename T> inline T plus(T x1,T x2){
- const T na = int64::LongVector<T>::na() ;
+ const T na = Rint64::LongVector<T>::na() ;
if( x1 == na || x2 == na ){
return na ;
}
@@ -44,7 +44,7 @@
return na ;
}
template <typename T> inline T minus(T x1,T x2){
- const T na = int64::LongVector<T>::na() ;
+ const T na = Rint64::LongVector<T>::na() ;
if( x1 == na || x2 == na){
return na ;
}
@@ -56,12 +56,12 @@
return na ;
}
template <> inline uint64_t minus<uint64_t>( uint64_t x1, uint64_t x2){
- const uint64_t na = int64::LongVector<uint64_t>::na() ;
+ const uint64_t na = Rint64::LongVector<uint64_t>::na() ;
if( x1 == na || x2 == na || x2 > x1) return na ;
return x1 - x2 ;
}
template <typename T> inline T times(T x1,T x2){
- const T na = int64::LongVector<T>::na() ;
+ const T na = Rint64::LongVector<T>::na() ;
if( x1 == na || x2 == na){
return na ;
}
@@ -73,21 +73,21 @@
return na ;
}
template <typename T> inline T divide(T x1,T x2){
- const T na = int64::LongVector<T>::na() ;
+ const T na = Rint64::LongVector<T>::na() ;
if( x1 == na || x2 == na ){
return na ;
}
return x1/x2 ;
}
template <typename T> inline T modulo(T x1,T x2){
- const T na = int64::LongVector<T>::na() ;
+ const T na = Rint64::LongVector<T>::na() ;
if( x1 == na || x2 == na ){
return na ;
}
return x1 % x2 ;
}
template <typename T> inline T int_div(T x1,T x2){
- const T na = int64::LongVector<T>::na() ;
+ const T na = Rint64::LongVector<T>::na() ;
if( x1 == na || x2 == na ){
return na ;
}
@@ -96,14 +96,14 @@
template <typename LONG, LONG Fun(LONG x1, LONG x2)>
SEXP arith_long_long(SEXP e1, SEXP e2){
- int64::LongVector<LONG> x1( e1 ) ;
- int64::LongVector<LONG> x2( e2 ) ;
+ Rint64::LongVector<LONG> x1( e1 ) ;
+ Rint64::LongVector<LONG> x2( e2 ) ;
int64_naflag = false ;
int n1 = x1.size(), n2 = x2.size();
LONG tmp ;
int i1 = 0, i2 = 0, i = 0 ;
int n = (n1>n2) ? n1 : n2 ;
- int64::LongVector<LONG> res(n) ;
+ Rint64::LongVector<LONG> res(n) ;
if( n1 == n2 ){
for( i=0; i<n1; i++){
@@ -132,25 +132,25 @@
template <typename LONG>
SEXP int64_arith__impl( const char* op, SEXP e1, SEXP e2){
if( ! strncmp(op, "+", 1) ){
- return int64::internal::arith_long_long<LONG, int64::internal::plus<LONG> >( e1, e2) ;
+ return Rint64::internal::arith_long_long<LONG, Rint64::internal::plus<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "-", 1 ) ) {
- return int64::internal::arith_long_long<LONG, int64::internal::minus<LONG> >( e1, e2) ;
+ return Rint64::internal::arith_long_long<LONG, Rint64::internal::minus<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "*", 1) ) {
- return int64::internal::arith_long_long<LONG, int64::internal::times<LONG> >( e1, e2) ;
+ return Rint64::internal::arith_long_long<LONG, Rint64::internal::times<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "^", 1 ) ) {
Rf_error( "pow not implemented for long type" ) ;
} else if( ! strncmp( op, "/", 1 ) ) {
- return int64::internal::arith_long_long<LONG, int64::internal::divide<LONG> >( e1, e2) ;
+ return Rint64::internal::arith_long_long<LONG, Rint64::internal::divide<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "%%", 2 ) ) {
- return int64::internal::arith_long_long<LONG, int64::internal::modulo<LONG> >( e1, e2) ;
+ return Rint64::internal::arith_long_long<LONG, Rint64::internal::modulo<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "%/%", 3 ) ) {
- return int64::internal::arith_long_long<LONG, int64::internal::int_div<LONG> >( e1, e2) ;
+ return Rint64::internal::arith_long_long<LONG, Rint64::internal::int_div<LONG> >( e1, e2) ;
}
Rf_error( "unknown operator" ) ;
return R_NilValue ;
}
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/as_character.h
===================================================================
--- pkg/int64/inst/include/int64/as_character.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/as_character.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -24,12 +24,12 @@
#include <iostream>
#include <sstream>
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename LONG>
SEXP int64_as_character( SEXP x){
- int64::LongVector<LONG> data( x ) ;
+ Rint64::LongVector<LONG> data( x ) ;
int n = data.size() ;
SEXP res = PROTECT( Rf_allocVector( STRSXP, n) ) ;
std::ostringstream stream ;
@@ -49,6 +49,6 @@
}
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/as_long.h
===================================================================
--- pkg/int64/inst/include/int64/as_long.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/as_long.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__as_long__h
#define int64__as_long__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename LONG>
@@ -30,6 +30,6 @@
}
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/compare.h
===================================================================
--- pkg/int64/inst/include/int64/compare.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/compare.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__compare__h
#define int64__compare__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename T> inline bool equals(T x1,T x2){ return x1 == x2 ; }
@@ -34,8 +34,8 @@
template <typename LONG, bool Fun(LONG x1, LONG x2)>
SEXP compare_long_long(SEXP e1, SEXP e2){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> x1( e1 ) ;
- int64::LongVector<LONG> x2( e2 ) ;
+ Rint64::LongVector<LONG> x1( e1 ) ;
+ Rint64::LongVector<LONG> x2( e2 ) ;
int n1 = x1.size(), n2 = x2.size() ;
LONG tmp ;
@@ -83,17 +83,17 @@
template <typename LONG>
SEXP int64_compare(const char* op, SEXP e1, SEXP e2){
if( ! strncmp(op, "==", 2) ){
- return int64::internal::compare_long_long<LONG, int64::internal::equals<LONG> >( e1, e2) ;
+ return Rint64::internal::compare_long_long<LONG, Rint64::internal::equals<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "!=", 2 ) ) {
- return int64::internal::compare_long_long<LONG, int64::internal::not_equals<LONG> >( e1, e2) ;
+ return Rint64::internal::compare_long_long<LONG, Rint64::internal::not_equals<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "<=", 2 ) ) {
- return int64::internal::compare_long_long<LONG, int64::internal::lower_than_or_equal<LONG> >( e1, e2) ;
+ return Rint64::internal::compare_long_long<LONG, Rint64::internal::lower_than_or_equal<LONG> >( e1, e2) ;
} else if( ! strncmp( op, ">=", 2 ) ) {
- return int64::internal::compare_long_long<LONG, int64::internal::greater_than_or_equal<LONG> >( e1, e2) ;
+ return Rint64::internal::compare_long_long<LONG, Rint64::internal::greater_than_or_equal<LONG> >( e1, e2) ;
} else if( ! strncmp( op, "<", 1 ) ) {
- return int64::internal::compare_long_long<LONG, int64::internal::lower_than<LONG> >( e1, e2) ;
+ return Rint64::internal::compare_long_long<LONG, Rint64::internal::lower_than<LONG> >( e1, e2) ;
} else if( ! strncmp( op, ">", 1 ) ) {
- return int64::internal::compare_long_long<LONG, int64::internal::greater_than<LONG> >( e1, e2) ;
+ return Rint64::internal::compare_long_long<LONG, Rint64::internal::greater_than<LONG> >( e1, e2) ;
}
Rf_error( "unknown operator" ) ;
return R_NilValue ;
@@ -102,6 +102,6 @@
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/format_binary.h
===================================================================
--- pkg/int64/inst/include/int64/format_binary.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/format_binary.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__binary__h
#define int64__binary__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename T>
@@ -44,7 +44,7 @@
template <typename LONG>
SEXP int64_format_binary_long(SEXP x){
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
SEXP res = PROTECT( Rf_allocVector( STRSXP, n ) ) ;
@@ -56,5 +56,5 @@
}
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/get_bits.h
===================================================================
--- pkg/int64/inst/include/int64/get_bits.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/get_bits.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__get_bits__h
#define int64__get_bits__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename T64>
@@ -36,5 +36,5 @@
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/get_class.h
===================================================================
--- pkg/int64/inst/include/int64/get_class.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/get_class.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__get_class__h
#define int64__get_class__h
-namespace int64{
+namespace Rint64{
namespace internal {
template <typename T>
Modified: pkg/int64/inst/include/int64/get_long.h
===================================================================
--- pkg/int64/inst/include/int64/get_long.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/get_long.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__get_long__h
#define int64__get_long__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename T>
@@ -31,6 +31,6 @@
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/int2.h
===================================================================
--- pkg/int64/inst/include/int64/int2.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/int2.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -22,7 +22,7 @@
#define int64_int2_h
-namespace int64{
+namespace Rint64{
namespace internal{
// we only use this for T=int
Modified: pkg/int64/inst/include/int64/int64.h
===================================================================
--- pkg/int64/inst/include/int64/int64.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/int64.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__int64__h
#define int64__int64__h
-namespace int64{
+namespace Rint64{
namespace internal {
bool int64_naflag = false ;
}
@@ -39,13 +39,13 @@
#include <int64/as_long.h>
#include <int64/as_character.h>
-namespace int64{
+namespace Rint64{
namespace internal {
template <typename LONG>
SEXP new_long(LONG x){
std::string klass = get_class<LONG>() ;
- int64::LongVector<LONG> y(1) ;
+ Rint64::LongVector<LONG> y(1) ;
y.set(0, x) ;
return y ;
}
@@ -53,7 +53,7 @@
template <typename LONG>
SEXP new_long_2(LONG x, LONG y){
std::string klass = get_class<LONG>() ;
- int64::LongVector<LONG> z(2) ;
+ Rint64::LongVector<LONG> z(2) ;
z.set(0, x ) ;
z.set(1, y ) ;
return z ;
Modified: pkg/int64/inst/include/int64/long_traits.h
===================================================================
--- pkg/int64/inst/include/int64/long_traits.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/long_traits.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64_long_traits_h
#define int64_long_traits_h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename LONG>
Modified: pkg/int64/inst/include/int64/math.h
===================================================================
--- pkg/int64/inst/include/int64/math.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/math.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,16 +21,16 @@
#ifndef int64__math__h
#define int64__math__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename LONG>
SEXP abs( SEXP x ){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
LONG tmp ;
- int64::LongVector<LONG> res(n) ;
+ Rint64::LongVector<LONG> res(n) ;
for( int i=0; i<n; i++){
tmp = data.get(i) ;
if( tmp == na ) res.set(i, na ) ;
@@ -44,7 +44,7 @@
template <typename LONG>
SEXP sign( SEXP x){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
LONG tmp ;
SEXP res = PROTECT(Rf_allocVector(REALSXP,n)) ;
@@ -64,9 +64,9 @@
template <typename LONG>
SEXP cummax( SEXP x){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
- int64::LongVector<LONG> res(n, na) ;
+ Rint64::LongVector<LONG> res(n, na) ;
LONG max = data.get(0) ;
res.set( 0, max) ;
LONG tmp = 0 ;
@@ -83,9 +83,9 @@
template <typename LONG>
SEXP cummin( SEXP x){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
- int64::LongVector<LONG> res(n, na) ;
+ Rint64::LongVector<LONG> res(n, na) ;
LONG max = data.get(0) ;
res.set( 0, max) ;
LONG tmp = 0 ;
@@ -102,9 +102,9 @@
template <typename LONG>
SEXP cumprod( SEXP x){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
- int64::LongVector<LONG> res(n, na) ;
+ Rint64::LongVector<LONG> res(n, na) ;
LONG prod = data.get(0) ;
res.set( 0, prod) ;
int64_naflag = false ;
@@ -122,9 +122,9 @@
template <typename LONG>
SEXP cumsum( SEXP x){
const LONG na = long_traits<LONG>::na() ;
- int64::LongVector<LONG> data(x) ;
+ Rint64::LongVector<LONG> data(x) ;
int n = data.size() ;
- int64::LongVector<LONG> res(x) ;
+ Rint64::LongVector<LONG> res(x) ;
LONG prod = data.get(0) ;
res.set( 0, prod) ;
int64_naflag = false ;
@@ -168,6 +168,6 @@
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/read_string.h
===================================================================
--- pkg/int64/inst/include/int64/read_string.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/read_string.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,7 +21,7 @@
#ifndef int64__read_string__h
#define int64__read_string__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <>
@@ -29,7 +29,7 @@
errno = 0 ;
int64_t res = strtoll( s, NULL, 0 ) ;
if( errno == ERANGE ) {
- res = int64::LongVector<int64_t>::na() ;
+ res = Rint64::LongVector<int64_t>::na() ;
int64_naflag = true ;
}
return res ;
@@ -40,7 +40,7 @@
errno = 0 ;
uint64_t res = strtoull( s, NULL, 0 ) ;
if( errno == ERANGE ) {
- res = int64::LongVector<uint64_t>::na() ;
+ res = Rint64::LongVector<uint64_t>::na() ;
int64_naflag = true ;
}
return res ;
@@ -48,6 +48,6 @@
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/read_string_forward.h
===================================================================
--- pkg/int64/inst/include/int64/read_string_forward.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/read_string_forward.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,13 +21,13 @@
#ifndef int64__read_string_forward_h
#define int64__read_string_forward_h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename LONG>
inline LONG read_string(const char* s) ;
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/inst/include/int64/summary.h
===================================================================
--- pkg/int64/inst/include/int64/summary.h 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/inst/include/int64/summary.h 2011-11-19 09:36:30 UTC (rev 3390)
@@ -21,14 +21,14 @@
#ifndef int64__summary__h
#define int64__summary__h
-namespace int64{
+namespace Rint64{
namespace internal{
template <typename LONG>
-SEXP summary__min( const int64::LongVector<LONG>& data){
+SEXP summary__min( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
LONG x = data.get(0) ;
- if( x == na ) return int64::internal::new_long<LONG>( na ) ;
+ if( x == na ) return Rint64::internal::new_long<LONG>( na ) ;
LONG tmp = x ;
int n = data.size() ;
for( int i=1; i<n; i++){
@@ -39,11 +39,11 @@
}
if( tmp < x ) x = tmp ;
}
- return int64::internal::new_long<LONG>( x ) ;
+ return Rint64::internal::new_long<LONG>( x ) ;
}
template <typename LONG>
-SEXP summary__max( const int64::LongVector<LONG>& data){
+SEXP summary__max( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
LONG x = data.get(0) ;
LONG tmp = x ;
@@ -56,15 +56,15 @@
}
if( tmp > x ) x = tmp ;
}
- return int64::internal::new_long<LONG>( x ) ;
+ return Rint64::internal::new_long<LONG>( x ) ;
}
template <typename LONG>
-SEXP summary__range( const int64::LongVector<LONG>& data){
+SEXP summary__range( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
LONG min = data.get(0) ;
LONG max = data.get(0) ;
- if( min == na ) return int64::internal::new_long_2<LONG>( na, na) ;
+ if( min == na ) return Rint64::internal::new_long_2<LONG>( na, na) ;
LONG tmp = min ;
int n = data.size() ;
for( int i=1; i<n; i++){
@@ -75,14 +75,14 @@
if( tmp < min ) min = tmp ;
if( tmp > max ) max = tmp ;
}
- return int64::internal::new_long_2<LONG>( min, max) ;
+ return Rint64::internal::new_long_2<LONG>( min, max) ;
}
template <typename LONG>
-SEXP summary__prod( const int64::LongVector<LONG>& data){
+SEXP summary__prod( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
LONG res = data.get(0) ;
- if( res == na ) return int64::internal::new_long<LONG>( na ) ;
+ if( res == na ) return Rint64::internal::new_long<LONG>( na ) ;
int n = data.size() ;
int64_naflag = false ;
for( int i=1; i<n; i++){
@@ -90,14 +90,14 @@
if( res == na) break ;
}
if( int64_naflag ) Rf_warning( "NAs introduced by overflow" ) ;
- return int64::internal::new_long<LONG>( res ) ;
+ return Rint64::internal::new_long<LONG>( res ) ;
}
template <typename LONG>
-SEXP summary__sum( const int64::LongVector<LONG>& data){
+SEXP summary__sum( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
LONG res = data.get(0) ;
- if( res == na ) return int64::internal::new_long<LONG>( na ) ;
+ if( res == na ) return Rint64::internal::new_long<LONG>( na ) ;
int n = data.size() ;
int64_naflag = false ;
@@ -107,11 +107,11 @@
}
if( int64_naflag ) Rf_warning( "NAs introduced by overflow" ) ;
- return int64::internal::new_long<LONG>( res ) ;
+ return Rint64::internal::new_long<LONG>( res ) ;
}
template <typename LONG>
-SEXP summary__any( const int64::LongVector<LONG>& data){
+SEXP summary__any( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
int n = data.size() ;
int res = 0 ;
@@ -136,7 +136,7 @@
}
template <typename LONG>
-SEXP summary__all( const int64::LongVector<LONG>& data){
+SEXP summary__all( const Rint64::LongVector<LONG>& data){
const LONG na = long_traits<LONG>::na() ;
int n = data.size() ;
int res = 1 ;
@@ -164,22 +164,22 @@
template <typename LONG>
SEXP int64_summary(const char* op, SEXP x){
- int64::LongVector<LONG> data( x ) ;
+ Rint64::LongVector<LONG> data( x ) ;
if( ! strncmp(op, "min", 3) ){
- return int64::internal::summary__min<LONG>( data ) ;
+ return Rint64::internal::summary__min<LONG>( data ) ;
} else if( !strncmp(op, "max", 3) ){
- return int64::internal::summary__max<LONG>( data ) ;
+ return Rint64::internal::summary__max<LONG>( data ) ;
} else if( !strncmp(op, "range", 5 ) ){
- return int64::internal::summary__range<LONG>( data ) ;
+ return Rint64::internal::summary__range<LONG>( data ) ;
} else if( !strncmp(op, "prod", 4) ){
- return int64::internal::summary__prod<LONG>( data ) ;
+ return Rint64::internal::summary__prod<LONG>( data ) ;
} else if( !strncmp(op, "sum", 3 ) ) {
- return int64::internal::summary__sum<LONG>( data ) ;
+ return Rint64::internal::summary__sum<LONG>( data ) ;
} else if( !strncmp(op, "any", 3 ) ){
- return int64::internal::summary__any<LONG>( data ) ;
+ return Rint64::internal::summary__any<LONG>( data ) ;
} else if( !strncmp(op, "all", 3) ){
- return int64::internal::summary__all<LONG>( data ) ;
+ return Rint64::internal::summary__all<LONG>( data ) ;
}
Rf_error( "unknown operator" ) ;
return R_NilValue ;
@@ -189,6 +189,6 @@
} // namespace internal
-} // namespace int64
+} // namespace Rint64
#endif
Modified: pkg/int64/src/int64.cpp
===================================================================
--- pkg/int64/src/int64.cpp 2011-11-18 22:16:52 UTC (rev 3389)
+++ pkg/int64/src/int64.cpp 2011-11-19 09:36:30 UTC (rev 3390)
@@ -23,7 +23,7 @@
#include <int64.h>
#include <limits>
-namespace int64{
+namespace Rint64{
namespace internal{
@@ -36,7 +36,7 @@
{
int* data = INTEGER(x) ;
for( int i=0; i<n; i++){
- SET_STRING_ELT( res, i, Rf_mkChar( int64::internal::format_binary__impl<int>( data[i] ) ) ) ;
+ SET_STRING_ELT( res, i, Rf_mkChar( Rint64::internal::format_binary__impl<int>( data[i] ) ) ) ;
}
break ;
}
@@ -44,7 +44,7 @@
{
double* p_x = REAL(x) ;
for( int i=0; i<n; i++){
- SET_STRING_ELT( res, i, Rf_mkChar( int64::internal::format_binary__impl<double>( p_x[i] ) ) );
+ SET_STRING_ELT( res, i, Rf_mkChar( Rint64::internal::format_binary__impl<double>( p_x[i] ) ) );
}
break ;
}
@@ -61,11 +61,11 @@
extern "C" SEXP int64_format_binary(SEXP x){
if( Rf_inherits( x, "int64" ) ){
- return int64::internal::int64_format_binary_long<int64_t>(x) ;
+ return Rint64::internal::int64_format_binary_long<int64_t>(x) ;
} else if( Rf_inherits( x, "uint64" ) ){
- return int64::internal::int64_format_binary_long<uint64_t>(x) ;
+ return Rint64::internal::int64_format_binary_long<uint64_t>(x) ;
} else {
- return int64::internal::int64_format_binary__standard(x);
+ return Rint64::internal::int64_format_binary__standard(x);
}
return R_NilValue ;
}
@@ -73,18 +73,18 @@
extern "C" SEXP int64_as_character_int64(SEXP x, SEXP unsign){
bool is_unsigned = INTEGER(unsign)[0] ;
if( is_unsigned ){
- return int64::internal::int64_as_character<uint64_t>( x ) ;
+ return Rint64::internal::int64_as_character<uint64_t>( x ) ;
} else {
- return int64::internal::int64_as_character<int64_t>( x ) ;
+ return Rint64::internal::int64_as_character<int64_t>( x ) ;
}
}
extern "C" SEXP int64_as_int64(SEXP x){
- return int64::internal::as_long<int64_t>(x) ;
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 3390
More information about the Rcpp-commits
mailing list