Skip to content

Commit

Permalink
Merge pull request #45 from mdsumner/fix-bitwise-logical
Browse files Browse the repository at this point in the history
fix CRAN warnings, bitwise logical and LazyData
  • Loading branch information
mdsumner authored Dec 5, 2022
2 parents 63f47d6 + 10a3f74 commit b7a53d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ Description: Provides a drop-in replacement for rasterize() from the 'raster'
aggregating multi-layer rasters. Uses the scan line algorithm attributed to
Wylie et al. (1967) <doi:10.1145/1465611.1465619>.
License: MIT + file LICENSE
LazyData: true
URL: https://github.com/ecohealthalliance/fasterize
BugReports: https://github.com/ecohealthalliance/fasterize/issues
RoxygenNote: 7.1.1
RoxygenNote: 7.2.1
SystemRequirements: C++11
Suggests:
testthat,
Expand Down
6 changes: 3 additions & 3 deletions src/pixelfn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef void (*PixelFn)(arma::mat &raster, arma::uword x, arma::uword y, double
void sumvalues(arma::mat &raster, arma::uword x, arma::uword y, double &value) {
raster.at(y, x) =
//it's probably dangerous to use Rcpp::internal
(Rcpp::internal::Rcpp_IsNA(raster.at(y, x)) |
(Rcpp::internal::Rcpp_IsNA(raster.at(y, x)) ||
Rcpp::internal::Rcpp_IsNA(value)) ?
value : (raster.at(y, x) + value);
}
Expand All @@ -31,14 +31,14 @@ void lastvalues(arma::mat &raster, arma::uword x, arma::uword y, double &value)

//Only set the value if it is smaller than current
void minvalues(arma::mat &raster, arma::uword x, arma::uword y, double &value) {
if(Rcpp::internal::Rcpp_IsNA(raster.at(y, x)) | (raster.at(y, x) > value)) {
if(Rcpp::internal::Rcpp_IsNA(raster.at(y, x)) || (raster.at(y, x) > value)) {
raster.at(y, x) = value;
}
}

//Only set the value if it is larger than current
void maxvalues(arma::mat &raster, arma::uword x, arma::uword y, double &value) {
if(Rcpp::internal::Rcpp_IsNA(raster.at(y, x)) | (raster.at(y, x) < value)) {
if(Rcpp::internal::Rcpp_IsNA(raster.at(y, x)) || (raster.at(y, x) < value)) {
raster.at(y, x) = value;
}
}
Expand Down

0 comments on commit b7a53d8

Please sign in to comment.