Skip to content

Commit

Permalink
fix iterator overlapping check
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed May 17, 2024
1 parent e7dd490 commit 7d4833a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,13 @@ KOKKOS_INLINE_FUNCTION void expect_no_overlap(
// with the cost of O(1)
// Currently, checks are made only if strides are identical
// If first_diff == 0, there is already an overlap
// If one of strides is 1, first_diff is always divisible
if (stride1 == stride2 || first_diff == 0) {
[[maybe_unused]] bool is_no_overlap = (first_diff % stride1);
KOKKOS_EXPECTS((&*first >= &*s_last || &*last <= &*s_first) ||
is_no_overlap);
} else if (stride1 == 1 || stride2 == 1) {
KOKKOS_EXPECTS(&*first >= &*s_last || &*last <= &*s_first);
}
}
}
Expand Down

0 comments on commit 7d4833a

Please sign in to comment.