diff --git a/thrust/thrust/system/cuda/detail/dispatch.h b/thrust/thrust/system/cuda/detail/dispatch.h index 7389f521e04..90f0c08892a 100644 --- a/thrust/thrust/system/cuda/detail/dispatch.h +++ b/thrust/thrust/system/cuda/detail/dispatch.h @@ -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(count) \ - > static_cast(thrust::detail::integer_traits::const_max)) \ - { \ - throw ::std::runtime_error( \ - "Input size exceeds the maximum allowable value for " #index_type \ - " (" + std::to_string(thrust::detail::integer_traits::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(count) \ + > static_cast(thrust::detail::integer_traits::const_max)) \ + { \ + throw ::std::runtime_error( \ + "Input size exceeds the maximum allowable value for " #index_type " (" \ + + std::to_string(thrust::detail::integer_traits::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(count1) + static_cast(count2) \ - > static_cast(thrust::detail::integer_traits::const_max)) \ - { \ - throw ::std::runtime_error( \ - "Combined input sizes exceed the maximum allowable value for " #index_type \ - " (" + std::to_string(thrust::detail::integer_traits::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(count1) + static_cast(count2) \ + > static_cast(thrust::detail::integer_traits::const_max)) \ + { \ + throw ::std::runtime_error( \ + "Combined input sizes exceed the maximum allowable value for " #index_type " (" \ + + std::to_string(thrust::detail::integer_traits::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) \