File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
libcudacxx/include/cuda/std Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -60,15 +60,13 @@ struct __execution_policy_base
6060 // ! @brief Extracts the execution policy from the stored _Policy
6161 [[nodiscard]] _CCCL_API static constexpr __execution_policy __get_policy () noexcept
6262 {
63- constexpr uint32_t __policy_mask{0x000000FF };
64- return __execution_policy{_Policy & __policy_mask};
63+ return __policy_to_execution_policy<_Policy>;
6564 }
6665
6766 // ! @brief Extracts the execution backend from the stored _Policy
6867 [[nodiscard]] _CCCL_API static constexpr __execution_backend __get_backend () noexcept
6968 {
70- constexpr uint32_t __backend_mask{0x0000FF00 };
71- return __execution_backend{(_Policy & __backend_mask) >> 8 };
69+ return __policy_to_execution_backend<_Policy>;
7270 }
7371};
7472
Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ enum class __execution_policy : uint8_t
3737 __parallel_unsequenced = __execution_policy::__parallel | __execution_policy::__unsequenced,
3838};
3939
40+ // ! @brief Extracts the execution policy from the stored _Policy
41+ template <uint32_t _Policy>
42+ inline constexpr __execution_policy __policy_to_execution_policy = __execution_policy{(_Policy & uint32_t {0x000000FF })};
43+
4044// ! @brief Enumerates the different backends we support
4145// ! @note Not an enum class because a user might specify multiple backends
4246enum __execution_backend : uint8_t
@@ -56,9 +60,10 @@ enum __execution_backend : uint8_t
5660
5761// ! @brief Extracts the execution backend from the stored _Policy
5862template <uint32_t _Policy>
59- inline constexpr __execution_backend __to_backend = __execution_backend{(_Policy & uint32_t {0x0000FF00 }) >> 8 };
63+ inline constexpr __execution_backend __policy_to_execution_backend =
64+ __execution_backend{(_Policy & uint32_t {0x0000FF00 }) >> 8 };
6065
61- template <uint32_t _Policy, __execution_backend _Backend = __to_backend <_Policy>>
66+ template <uint32_t _Policy, __execution_backend _Backend = __policy_to_execution_backend <_Policy>>
6267struct __execution_policy_base ;
6368
6469_CCCL_END_NAMESPACE_CUDA_STD_EXECUTION
You can’t perform that action at this time.
0 commit comments