Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Aug 28, 2024
1 parent 096c5d4 commit 06930d7
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions thrust/thrust/system/cuda/detail/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,31 @@
#elif defined(THRUST_FORCE_32BIT_OFFSET_TYPE)

//! @brief Ensures that the size of the input does not overflow the offset type
# define _THRUST_INDEX_TYPE_DISPATCH_GUARD_OVERFLOW(index_type, count) \
if (static_cast<std::uint64_t>(count) \
> static_cast<std::uint64_t>(thrust::detail::integer_traits<index_type>::const_max)) \
{ \
throw ::std::runtime_error( \
"Input size exceeds the maximum allowable value for " #index_type \
" (" + std::to_string(thrust::detail::integer_traits<index_type>::const_max) + "). " \
#index_type " was used because the macro THRUST_FORCE_32BIT_OFFSET_TYPE was defined. "\
"To handle larger input sizes, either remove this macro to dynamically dispatch " \
"between 32-bit and 64-bit index types, or define THRUST_FORCE_64BIT_OFFSET_TYPE.")
}
# define _THRUST_INDEX_TYPE_DISPATCH_GUARD_OVERFLOW(index_type, count) \
if (static_cast<std::uint64_t>(count) \
> static_cast<std::uint64_t>(thrust::detail::integer_traits<index_type>::const_max)) \
{ \
throw ::std::runtime_error( \
"Input size exceeds the maximum allowable value for " #index_type " (" \
+ std::to_string(thrust::detail::integer_traits<index_type>::const_max) \
+ "). " #index_type " was used because the macro THRUST_FORCE_32BIT_OFFSET_TYPE was defined. " \
"To handle larger input sizes, either remove this macro to dynamically dispatch " \
"between 32-bit and 64-bit index types, or define THRUST_FORCE_64BIT_OFFSET_TYPE.")
}

//! @brief Ensures that the sizes of the inputs do not overflow the offset type, but two counts
# define _THRUST_INDEX_TYPE_DISPATCH_GUARD_OVERFLOW2(index_type, count1, count2) \
if (static_cast<std::uint64_t>(count1) + static_cast<std::uint64_t>(count2) \
> static_cast<std::uint64_t>(thrust::detail::integer_traits<index_type>::const_max)) \
{ \
throw ::std::runtime_error( \
"Combined input sizes exceed the maximum allowable value for " #index_type \
" (" + std::to_string(thrust::detail::integer_traits<index_type>::const_max) + "). " \
#index_type " was used because the macro THRUST_FORCE_32BIT_OFFSET_TYPE was defined. "\
"To handle larger input sizes, either remove this macro to dynamically dispatch " \
"between 32-bit and 64-bit index types, or define THRUST_FORCE_64BIT_OFFSET_TYPE."); \```
}
# define _THRUST_INDEX_TYPE_DISPATCH_GUARD_OVERFLOW2(index_type, count1, count2) \
if (static_cast<std::uint64_t>(count1) + static_cast<std::uint64_t>(count2) \
> static_cast<std::uint64_t>(thrust::detail::integer_traits<index_type>::const_max)) \
{ \
throw ::std::runtime_error( \
"Combined input sizes exceed the maximum allowable value for " #index_type " (" \
+ std::to_string(thrust::detail::integer_traits<index_type>::const_max) \
+ "). " #index_type " was used because the macro THRUST_FORCE_32BIT_OFFSET_TYPE was defined. " \
"To handle larger input sizes, either remove this macro to dynamically dispatch " \
"between 32-bit and 64-bit index types, or define THRUST_FORCE_64BIT_OFFSET_TYPE."); \
\```
}

//! @brief Always dispatches to 32 bit offset version of an algorithm but throws if count would overflow
# define THRUST_INDEX_TYPE_DISPATCH(status, call, count, arguments) \
Expand Down

0 comments on commit 06930d7

Please sign in to comment.