diff --git a/inst/include/Rcpp/sugar/functions/rowSums.h b/inst/include/Rcpp/sugar/functions/rowSums.h index dd51312a8..99adbd8d2 100644 --- a/inst/include/Rcpp/sugar/functions/rowSums.h +++ b/inst/include/Rcpp/sugar/functions/rowSums.h @@ -63,12 +63,12 @@ inline void incr(Rcomplex* lhs, const Rcomplex& rhs) { inline void div(double* lhs, R_xlen_t rhs) { - *lhs /= rhs; + *lhs /= static_cast(rhs); } inline void div(Rcomplex* lhs, R_xlen_t rhs) { - lhs->r /= rhs; - lhs->i /= rhs; + lhs->r /= static_cast(rhs); + lhs->i /= static_cast(rhs); } diff --git a/inst/include/Rcpp/sugar/functions/sample.h b/inst/include/Rcpp/sugar/functions/sample.h index 249640b04..9f4817b1c 100644 --- a/inst/include/Rcpp/sugar/functions/sample.h +++ b/inst/include/Rcpp/sugar/functions/sample.h @@ -57,7 +57,7 @@ namespace sugar { inline void Normalize(Vector& p, int require_k, bool replace) { double sum = 0.0; - int npos = 0, i = 0, n = p.size(); + R_xlen_t npos = 0, i = 0, n = p.size(); for ( ; i < n; i++) { if (!R_FINITE(p[i]) || (p[i] < 0)) { diff --git a/inst/include/Rcpp/sugar/functions/strings/trimws.h b/inst/include/Rcpp/sugar/functions/strings/trimws.h index 92ca7a409..5783feead 100644 --- a/inst/include/Rcpp/sugar/functions/strings/trimws.h +++ b/inst/include/Rcpp/sugar/functions/strings/trimws.h @@ -133,7 +133,8 @@ inline Vector trimws(const Vector& x, const char* which = "both" } inline Matrix trimws(const Matrix& x, const char* which = "both") { - R_xlen_t i = 0, nr = x.nrow(), nc = x.ncol(), sz = x.size(); + R_xlen_t i = 0, sz = x.size(); + int nr = x.nrow(), nc = x.ncol(); Matrix res = no_init(nr, nc); std::string buffer;