Skip to content

Commit

Permalink
boolean not bitwise
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed May 12, 2024
1 parent d469581 commit 073cf31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# include <Rinternals.h>

void check_size(SEXP size) {
if ((INTEGER(size)[0] == R_NaInt) | (INTEGER(size)[0] < 1)) {
if ((INTEGER(size)[0] == R_NaInt) || (INTEGER(size)[0] < 1)) {
Rf_error("%s", "bad dimension ncol or nrow is < 1 or missing");
}
}
void check_range(SEXP range) {
double c_max = REAL(range)[1];
double c_min = REAL(range)[0];
if (!R_finite(c_max) | !R_finite(c_min) | (c_max <= c_min)) {
if (!R_finite(c_max) || !R_finite(c_min) || (c_max <= c_min)) {
Rf_error("%s", "bad extent, xmax <= xmin, ymax <= ymin, or missing values");
}
}
Expand All @@ -23,10 +23,10 @@ void check_extent(SEXP extent) {
double y_min = REAL(extent)[2];
double x_max = REAL(extent)[1];
double x_min = REAL(extent)[0];
if (!R_finite(x_max) | !R_finite(x_min) | (x_max <= x_min)) {
if (!R_finite(x_max) || !R_finite(x_min) || (x_max <= x_min)) {
Rf_error("%s", "bad extent, xmax <= xmin or missing values");
}
if (!R_finite(y_max) | !R_finite(y_min) | (y_max <= y_min)) {
if (!R_finite(y_max) || !R_finite(y_min) || (y_max <= y_min)) {
Rf_error("%s", "bad extent, ymax <= ymin or missing values");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/coordinates.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SEXP bin_from_float(SEXP bins, SEXP range, SEXP coord) {
for (int i = 0; i < nn; i++) {
if (rcoord[i] == cmax) {
rout[i] = rbin - 1;
} else if ((rcoord[i] > cmax) | (rcoord[i] < cmin)) {
} else if ((rcoord[i] > cmax) || (rcoord[i] < cmin)) {
rout[i] = R_NaReal;
} else {
rout[i] = trunc((cmax - rcoord[i])/scl);
Expand Down

0 comments on commit 073cf31

Please sign in to comment.