Skip to content

Commit 27e0339

Browse files
author
Qiang Kou
committed
sugar done
1 parent b94441b commit 27e0339

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

inst/include/Rcpp/sugar/matrix/as_vector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ template <int RTYPE, bool NA, typename T>
2929
inline Rcpp::Vector<RTYPE>
3030
as_vector__impl( MatrixBase<RTYPE,NA,T>& t, Rcpp::traits::false_type ){
3131
T& ref = t.get_ref() ;
32-
R_xlen_t nc = ref.ncol(), nr = ref.nrow() ;
32+
int nc = ref.ncol(), nr = ref.nrow() ;
3333
Vector<RTYPE> out (nr*nc) ;
3434
R_xlen_t k =0;
35-
for( R_xlen_t col_index=0; col_index<nc; col_index++)
36-
for( R_xlen_t row_index=0; row_index<nr; row_index++, k++)
35+
for( int col_index=0; col_index<nc; col_index++)
36+
for( int row_index=0; row_index<nr; row_index++, k++)
3737
out[k] = ref( row_index, col_index ) ;
3838

3939
return out ;

inst/include/Rcpp/sugar/nona/nona.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ namespace sugar {
3333

3434
Nona( const SUGAR_TYPE& expr) : data(expr.get_ref()){}
3535

36-
inline int size() const { return data.size() ; }
37-
inline STORAGE operator[](int i) const { return data[i] ; }
36+
inline R_xlen_t size() const { return data.size() ; }
37+
inline STORAGE operator[](R_xlen_t i) const { return data[i] ; }
3838

3939
private:
4040
const VECTOR& data ;
@@ -50,12 +50,12 @@ namespace sugar {
5050

5151
Nona( const SUGAR_TYPE& expr) : data(expr.get_ref().begin()), n(expr.size()){}
5252

53-
inline int size() const { return n ; }
54-
inline STORAGE operator[](int i) const { return data[i] ; }
53+
inline R_xlen_t size() const { return n ; }
54+
inline STORAGE operator[](R_xlen_t i) const { return data[i] ; }
5555

5656
private:
5757
iterator data ;
58-
int n ;
58+
R_xlen_t n ;
5959
} ;
6060

6161
template <typename T>

inst/include/Rcpp/sugar/tools/iterator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ namespace sugar {
3030
class SugarIterator {
3131
public:
3232

33-
typedef int difference_type ;
33+
typedef R_xlen_t difference_type ;
3434
typedef typename Rcpp::traits::storage_type< Rcpp::traits::r_sexptype_traits<T>::rtype >::type STORAGE_TYPE ;
3535
typedef STORAGE_TYPE reference ;
3636
typedef STORAGE_TYPE* pointer ;
3737
typedef std::random_access_iterator_tag iterator_category ;
3838
typedef SugarIterator iterator ;
3939

4040
SugarIterator( const T& ref_ ) :ref(ref_), index(0) {}
41-
SugarIterator( const T& ref_, int index_) : ref(ref_), index(index_) {}
41+
SugarIterator( const T& ref_, R_xlen_t index_) : ref(ref_), index(index_) {}
4242
SugarIterator( const SugarIterator& other) : ref(other.ref), index(other.index){}
4343

4444
inline iterator& operator++(){ index++; return *this ; }
@@ -67,7 +67,7 @@ namespace sugar {
6767
index -= n;
6868
return *this ;
6969
}
70-
inline reference operator[](int i){
70+
inline reference operator[](R_xlen_t i){
7171
return ref[index+i] ;
7272
}
7373

@@ -104,7 +104,7 @@ namespace sugar {
104104

105105
private:
106106
const T& ref ;
107-
int index ;
107+
R_xlen_t index ;
108108
} ;
109109

110110
template <typename T> struct sugar_const_iterator_type {

0 commit comments

Comments
 (0)