Skip to content

Commit

Permalink
Avoid symbol clashes with libc++ (#2955)
Browse files Browse the repository at this point in the history
* Drop `__libcpp` prefix in favor of `__cccl`

libc++ has moved towards just using unqualified `std::` for any partial qualification.

That leads to a high chance of symbol clashes if we use the same names as them. As a first replace all uses of `__libcpp` with `_cccl`

I was wondering about `__libcupp` but 🤷

* Backport `is_constant_evaluated`
  • Loading branch information
miscco authored Nov 26, 2024
1 parent 7d35d56 commit 658e0bb
Show file tree
Hide file tree
Showing 86 changed files with 455 additions and 493 deletions.
2 changes: 1 addition & 1 deletion cudax/include/cuda/experimental/__async/stop_token.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct __spin_wait
else
{
--__count_;
_CUDA_VSTD::__libcpp_thread_yield_processor();
_CUDA_VSTD::__cccl_thread_yield_processor();
}
}

Expand Down
16 changes: 8 additions & 8 deletions libcudacxx/include/cuda/__barrier/barrier_block_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class barrier<thread_scope_block, _CUDA_VSTD::__empty_completion> : public __blo
(
int32_t __ready = 0;
if (!__isClusterShared(&__barrier)) {
return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_phase<barrier>(this, _CUDA_VSTD::move(__token)), __nanosec);
} else if (!__isShared(&__barrier)) { __trap(); }

Expand All @@ -256,7 +256,7 @@ class barrier<thread_scope_block, _CUDA_VSTD::__empty_completion> : public __blo
(
bool __ready = 0;
if (!__isShared(&__barrier)) {
return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_phase<barrier>(this, _CUDA_VSTD::move(__token)), __nanosec);
}

Expand All @@ -267,7 +267,7 @@ class barrier<thread_scope_block, _CUDA_VSTD::__empty_completion> : public __blo
} while (!__ready && __nanosec > (_CUDA_VSTD::chrono::high_resolution_clock::now() - __start));
return __ready;),
NV_ANY_TARGET,
(return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
(return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_phase<barrier>(this, _CUDA_VSTD::move(__token)),
_CUDA_VSTD::chrono::nanoseconds(__nanosec));))
}
Expand Down Expand Up @@ -331,7 +331,7 @@ class barrier<thread_scope_block, _CUDA_VSTD::__empty_completion> : public __blo
(
int32_t __ready = 0;
if (!__isClusterShared(&__barrier)) {
return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_parity<barrier>(this, __phase_parity), __nanosec);
} else if (!__isShared(&__barrier)) { __trap(); }

Expand Down Expand Up @@ -359,7 +359,7 @@ class barrier<thread_scope_block, _CUDA_VSTD::__empty_completion> : public __blo
(
bool __ready = 0;
if (!__isShared(&__barrier)) {
return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_parity<barrier>(this, __phase_parity), __nanosec);
}

Expand All @@ -371,20 +371,20 @@ class barrier<thread_scope_block, _CUDA_VSTD::__empty_completion> : public __blo

return __ready;),
NV_ANY_TARGET,
(return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
(return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_parity<barrier>(this, __phase_parity), __nanosec);))
}

public:
_LIBCUDACXX_HIDE_FROM_ABI void wait(arrival_token&& __phase) const
{
_CUDA_VSTD::__libcpp_thread_poll_with_backoff(
_CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_phase<barrier>(this, _CUDA_VSTD::move(__phase)));
}

_LIBCUDACXX_HIDE_FROM_ABI void wait_parity(bool __phase_parity) const
{
_CUDA_VSTD::__libcpp_thread_poll_with_backoff(
_CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_parity<barrier>(this, __phase_parity));
}

Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public:
_LIBCUDACXX_HIDE_FROM_ABI bool consumer_wait_for(const _CUDA_VSTD::chrono::duration<_Rep, _Period>& __duration)
{
barrier<_Scope>& __stage_barrier = __shared_state_get_stage(__tail)->__produced;
return _CUDA_VSTD::__libcpp_thread_poll_with_backoff(
return _CUDA_VSTD::__cccl_thread_poll_with_backoff(
_CUDA_VSTD::__barrier_poll_tester_parity<barrier<_Scope>>(&__stage_barrier, __produced_phase_parity),
_CUDA_VSTD::chrono::duration_cast<_CUDA_VSTD::chrono::nanoseconds>(__duration));
}
Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/std/__algorithm/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 bool __dispatch_memmove(_Up* __r
return false;
#endif

if (__libcpp_is_constant_evaluated())
if (_CUDA_VSTD::is_constant_evaluated())
{
return false;
}
Expand Down Expand Up @@ -114,7 +114,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 pair<_Tp*, _Up*> __copy(_Tp* __f
{
return {__last, __result + __n};
}
if ((!__libcpp_is_constant_evaluated() && __first < __result)
if ((!_CUDA_VSTD::is_constant_evaluated() && __first < __result)
|| __constexpr_tail_overlap(__first, __result, __last))
{
for (ptrdiff_t __i = __n; __i > 0; --__i)
Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/std/__atomic/wait/notify_wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ _LIBCUDACXX_HIDE_FROM_ABI void __atomic_wait(
}
if (__i < 12)
{
_CUDA_VSTD::__libcpp_thread_yield_processor();
_CUDA_VSTD::__cccl_thread_yield_processor();
}
else
{
_CUDA_VSTD::__libcpp_thread_yield();
_CUDA_VSTD::__cccl_thread_yield();
}
}
while (__nonatomic_compare_equal(__atomic_load_dispatch(__a, __order, _Sco{}), __val))
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/__atomic/wait/polling.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ template <typename _Tp, typename _Sco>
_CCCL_HOST_DEVICE void __atomic_try_wait_slow_fallback(
_Tp const volatile* __a, __atomic_underlying_remove_cv_t<_Tp> __val, memory_order __order, _Sco)
{
_CUDA_VSTD::__libcpp_thread_poll_with_backoff(__atomic_poll_tester<_Tp, _Sco>(__a, __val, __order));
_CUDA_VSTD::__cccl_thread_poll_with_backoff(__atomic_poll_tester<_Tp, _Sco>(__a, __val, __order));
}

_LIBCUDACXX_END_NAMESPACE_STD
Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/std/__barrier/barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ class __barrier_base<__empty_completion, _Sco>
}
_LIBCUDACXX_HIDE_FROM_ABI void wait(arrival_token&& __phase) const
{
_CUDA_VSTD::__libcpp_thread_poll_with_backoff(
_CUDA_VSTD::__cccl_thread_poll_with_backoff(
__barrier_poll_tester_phase<__barrier_base>(this, _CUDA_VSTD::move(__phase)));
}
_LIBCUDACXX_HIDE_FROM_ABI void wait_parity(bool __parity) const
{
_CUDA_VSTD::__libcpp_thread_poll_with_backoff(__barrier_poll_tester_parity<__barrier_base>(this, __parity));
_CUDA_VSTD::__cccl_thread_poll_with_backoff(__barrier_poll_tester_parity<__barrier_base>(this, __parity));
}
_LIBCUDACXX_HIDE_FROM_ABI void arrive_and_wait()
{
Expand Down
16 changes: 8 additions & 8 deletions libcudacxx/include/cuda/std/__bit/clz.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __constexpr_clz(uint64_t __x) noexcept
# endif
}

_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_clz(uint32_t __x) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_clz(uint32_t __x) noexcept
{
# if _CCCL_STD_VER >= 2014
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
NV_IF_ELSE_TARGET(NV_IS_DEVICE, (return __clz(__x);), (return __builtin_clz(__x);))
}
# endif
return __constexpr_clz(__x);
}

_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_clz(uint64_t __x) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_clz(uint64_t __x) noexcept
{
# if _CCCL_STD_VER >= 2014
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
NV_IF_ELSE_TARGET(NV_IS_DEVICE, (return __clzll(__x);), (return __builtin_clzll(__x);))
}
Expand All @@ -100,10 +100,10 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_clz(uint64_t __x) noexcept
#else // _CCCL_COMPILER(MSVC)

// Precondition: __x != 0
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_clz(uint32_t __x)
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_clz(uint32_t __x)
{
# if !defined(__CUDA_ARCH__)
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
unsigned long __where = 0;
if (_BitScanReverse(&__where, __x))
Expand All @@ -117,10 +117,10 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_clz(uint32_t __x)
return __binary_clz32(static_cast<uint64_t>(__x), 0);
}

_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_clz(uint64_t __x)
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_clz(uint64_t __x)
{
# if !defined(__CUDA_ARCH__)
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
unsigned long __where = 0;
# if defined(_LIBCUDACXX_HAS_BITSCAN64)
Expand Down
13 changes: 6 additions & 7 deletions libcudacxx/include/cuda/std/__bit/countl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<sizeof(_Tp) <= sizeof(uint32_t), int>
__countl_zero_dispatch(_Tp __t) noexcept
{
return __libcpp_clz(static_cast<uint32_t>(__t)) - (numeric_limits<uint32_t>::digits - numeric_limits<_Tp>::digits);
return __cccl_clz(static_cast<uint32_t>(__t)) - (numeric_limits<uint32_t>::digits - numeric_limits<_Tp>::digits);
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<sizeof(_Tp) == sizeof(uint64_t), int>
__countl_zero_dispatch(_Tp __t) noexcept
{
return __libcpp_clz(static_cast<uint64_t>(__t)) - (numeric_limits<uint64_t>::digits - numeric_limits<_Tp>::digits);
return __cccl_clz(static_cast<uint64_t>(__t)) - (numeric_limits<uint64_t>::digits - numeric_limits<_Tp>::digits);
}

template <typename _Tp, int _St = sizeof(_Tp) / sizeof(uint64_t)>
Expand Down Expand Up @@ -90,27 +90,26 @@ __countl_zero_dispatch(_Tp __t) noexcept
template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __countl_zero(_Tp __t) noexcept
{
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires unsigned");
static_assert(__cccl_is_unsigned_integer<_Tp>::value, "__countl_zero requires unsigned");
return __t ? __countl_zero_dispatch(__t) : numeric_limits<_Tp>::digits;
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __countl_one(_Tp __t) noexcept
{
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_one requires unsigned");
static_assert(__cccl_is_unsigned_integer<_Tp>::value, "__countl_one requires unsigned");
return __t != numeric_limits<_Tp>::max() ? __countl_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits;
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, int>
countl_zero(_Tp __t) noexcept
{
return __countl_zero(__t);
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
countl_one(_Tp __t) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, int> countl_one(_Tp __t) noexcept
{
return __countl_one(__t);
}
Expand Down
13 changes: 6 additions & 7 deletions libcudacxx/include/cuda/std/__bit/countr.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<sizeof(_Tp) <= sizeof(uint32_t), int>
__countr_zero_dispatch(_Tp __t) noexcept
{
return __libcpp_ctz(static_cast<uint32_t>(__t));
return __cccl_ctz(static_cast<uint32_t>(__t));
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<sizeof(_Tp) == sizeof(uint64_t), int>
__countr_zero_dispatch(_Tp __t) noexcept
{
return __libcpp_ctz(static_cast<uint64_t>(__t));
return __cccl_ctz(static_cast<uint64_t>(__t));
}

template <typename _Tp, int _St = sizeof(_Tp) / sizeof(uint64_t)>
Expand Down Expand Up @@ -83,28 +83,27 @@ __countr_zero_dispatch(_Tp __t) noexcept
template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __countr_zero(_Tp __t) noexcept
{
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countr_zero requires unsigned");
static_assert(__cccl_is_unsigned_integer<_Tp>::value, "__countr_zero requires unsigned");

return __t ? __countr_zero_dispatch(__t) : numeric_limits<_Tp>::digits;
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __countr_one(_Tp __t) noexcept
{
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countr_one requires unsigned");
static_assert(__cccl_is_unsigned_integer<_Tp>::value, "__countr_one requires unsigned");
return __t != numeric_limits<_Tp>::max() ? __countr_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits;
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, int>
countr_zero(_Tp __t) noexcept
{
return __countr_zero(__t);
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
countr_one(_Tp __t) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, int> countr_one(_Tp __t) noexcept
{
return __countr_one(__t);
}
Expand Down
16 changes: 8 additions & 8 deletions libcudacxx/include/cuda/std/__bit/ctz.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __constexpr_ctz(uint64_t __x) noexcept
# endif
}

_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint32_t __x) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_ctz(uint32_t __x) noexcept
{
# if _CCCL_STD_VER >= 2014
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
NV_IF_ELSE_TARGET(
NV_IS_DEVICE, (return (!__x) ? (sizeof(uint32_t) * 8) : (__ffs(__x) - 1);), (return __builtin_ctz(__x);))
Expand All @@ -87,10 +87,10 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint32_t __x) noexcept
return __constexpr_ctz(__x);
}

_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint64_t __x) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_ctz(uint64_t __x) noexcept
{
# if _CCCL_STD_VER >= 2014
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
NV_IF_ELSE_TARGET(
NV_IS_DEVICE, (return (!__x) ? (sizeof(uint64_t) * 8) : (__ffsll(__x) - 1);), (return __builtin_ctzll(__x);))
Expand All @@ -102,10 +102,10 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint64_t __x) noexcept
#else // _CCCL_COMPILER(MSVC)

// Precondition: __x != 0
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint32_t __x)
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_ctz(uint32_t __x)
{
# if !defined(__CUDA_ARCH__)
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
unsigned long __where = 0;
if (_BitScanForward(&__where, __x))
Expand All @@ -119,10 +119,10 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint32_t __x)
return __binary_ctz32(static_cast<uint64_t>(__x), 0);
}

_LIBCUDACXX_HIDE_FROM_ABI constexpr int __libcpp_ctz(uint64_t __x)
_LIBCUDACXX_HIDE_FROM_ABI constexpr int __cccl_ctz(uint64_t __x)
{
# if !defined(__CUDA_ARCH__)
if (!__libcpp_default_is_constant_evaluated())
if (!__cccl_default_is_constant_evaluated())
{
unsigned long __where = 0;
# if defined(_LIBCUDACXX_HAS_BITSCAN64) && (defined(_M_AMD64) || defined(__x86_64__))
Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/std/__bit/has_single_bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD
template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr bool __has_single_bit(_Tp __t) noexcept
{
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned");
static_assert(__cccl_is_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned");
return __t != 0 && (((__t & (__t - 1)) == 0));
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, bool>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, bool>
has_single_bit(_Tp __t) noexcept
{
return __has_single_bit(__t);
Expand Down
10 changes: 4 additions & 6 deletions libcudacxx/include/cuda/std/__bit/integral.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD
template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr uint32_t __bit_log2(_Tp __t) noexcept
{
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned");
static_assert(__cccl_is_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned");
return numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
}

Expand All @@ -51,21 +51,19 @@ _LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<sizeof(_Tp) < sizeof(uint32_t),
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
bit_floor(_Tp __t) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, _Tp> bit_floor(_Tp __t) noexcept
{
return __t == 0 ? 0 : static_cast<_Tp>(_Tp{1} << __bit_log2(__t));
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> bit_ceil(_Tp __t) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, _Tp> bit_ceil(_Tp __t) noexcept
{
return (__t < 2) ? 1 : static_cast<_Tp>(__ceil2(__t));
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
bit_width(_Tp __t) noexcept
_LIBCUDACXX_HIDE_FROM_ABI constexpr enable_if_t<__cccl_is_unsigned_integer<_Tp>::value, int> bit_width(_Tp __t) noexcept
{
return __t == 0 ? 0 : static_cast<int>(__bit_log2(__t) + 1);
}
Expand Down
Loading

0 comments on commit 658e0bb

Please sign in to comment.