Skip to content

Commit 2b0e83d

Browse files
fix ranges_overlap (#7588) (#7599)
(cherry picked from commit d539f41) Co-authored-by: David Bayer <48736217+davebayer@users.noreply.github.com>
1 parent 17d84ba commit 2b0e83d

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

libcudacxx/include/cuda/__memory/ranges_overlap.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434

3535
_CCCL_BEGIN_NAMESPACE_CUDA
3636

37-
#if _CCCL_DEVICE_COMPILATION()
38-
39-
[[nodiscard]]
40-
_CCCL_DEVICE_API inline bool __ptr_ranges_overlap_device(
37+
#if _CCCL_CUDA_COMPILATION()
38+
[[nodiscard]] _CCCL_DEVICE_API inline bool __ptr_ranges_overlap_device(
4139
const void* __lhs_begin, const void* __lhs_end, const void* __rhs_begin, const void* __rhs_end) noexcept
4240
{
4341
using uintptr_t = ::cuda::std::uintptr_t;
@@ -49,20 +47,18 @@ _CCCL_DEVICE_API inline bool __ptr_ranges_overlap_device(
4947
_CCCL_ASSERT(__rhs_start_ptr <= __rhs_end_ptr, "rhs range is invalid");
5048
return __lhs_start_ptr < __rhs_end_ptr && __rhs_start_ptr < __lhs_end_ptr;
5149
}
50+
#endif // _CCCL_CUDA_COMPILATION()
5251

53-
#else // ^^^^ _CCCL_DEVICE_COMPILATION() ^^^^ / vvvv _CCCL_HOST_COMPILATION() vvvv
54-
52+
#if !_CCCL_COMPILER(NVRTC)
5553
template <typename _Tp>
56-
[[nodiscard]]
57-
_CCCL_HOST_API bool
54+
[[nodiscard]] _CCCL_HOST_API bool
5855
__ptr_ranges_overlap_host(_Tp* __lhs_begin, _Tp* __lhs_end, _Tp* __rhs_begin, _Tp* __rhs_end) noexcept
5956
{
6057
_CCCL_ASSERT(::std::less_equal<>{}(__lhs_begin, __lhs_end), "lhs range is invalid");
6158
_CCCL_ASSERT(::std::less_equal<>{}(__rhs_begin, __rhs_end), "rhs range is invalid");
6259
return ::std::less<>{}(__lhs_begin, __rhs_end) && ::std::less<>{}(__rhs_begin, __lhs_end);
6360
}
64-
65-
#endif // ^^^^ _CCCL_HOST_COMPILATION() ^^^^
61+
#endif // !_CCCL_COMPILER(NVRTC)
6662

6763
_CCCL_TEMPLATE(typename _Tp)
6864
_CCCL_REQUIRES(::cuda::std::forward_iterator<_Tp>)

0 commit comments

Comments
 (0)