Skip to content

Commit

Permalink
Upload headers [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
ilobilo committed Oct 20, 2023
1 parent 8222dca commit 66d5c13
Show file tree
Hide file tree
Showing 17 changed files with 673 additions and 468 deletions.
4 changes: 2 additions & 2 deletions include/array
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
array<remove_cv_t<_Tp>, _Nm> __arr;
if (!__is_constant_evaluated() && _Nm != 0)
__builtin_memcpy(__arr.data(), __a, sizeof(__a));
__builtin_memcpy((void*)__arr.data(), (void*)__a, sizeof(__a));
else
for (size_t __i = 0; __i < _Nm; ++__i)
__arr._M_elems[__i] = __a[__i];
Expand Down Expand Up @@ -461,7 +461,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
array<remove_cv_t<_Tp>, _Nm> __arr;
if (!__is_constant_evaluated() && _Nm != 0)
__builtin_memcpy(__arr.data(), __a, sizeof(__a));
__builtin_memcpy((void*)__arr.data(), (void*)__a, sizeof(__a));
else
for (size_t __i = 0; __i < _Nm; ++__i)
__arr._M_elems[__i] = __a[__i];
Expand Down
28 changes: 14 additions & 14 deletions include/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -388,23 +388,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return compare_exchange_strong(__e, __i, __m,
__cmpexch_failure_order(__m)); }

#if __cpp_lib_atomic_wait
void
wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
{
std::__atomic_wait_address_v(&_M_i, __old,
[__m, this] { return this->load(__m); });
}
#if __cpp_lib_atomic_wait // C++ >= 20
void
wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
{
std::__atomic_wait_address_v(&_M_i, __old,
[__m, this] { return this->load(__m); });
}

// TODO add const volatile overload
// TODO add const volatile overload

void
notify_one() noexcept
{ std::__atomic_notify_address(&_M_i, false); }
void
notify_one() noexcept
{ std::__atomic_notify_address(&_M_i, false); }

void
notify_all() noexcept
{ std::__atomic_notify_address(&_M_i, true); }
void
notify_all() noexcept
{ std::__atomic_notify_address(&_M_i, true); }
#endif // __cpp_lib_atomic_wait

};
Expand Down
54 changes: 27 additions & 27 deletions include/bit
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#if __cplusplus >= 201402L

#include <concepts> // for std::integral
#include <type_traits>

#if _GLIBCXX_HOSTED || __has_include(<ext/numeric_traits.h>)
Expand Down Expand Up @@ -103,9 +104,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return An object of the same type, with the bytes reversed.
* @since C++23
*/
template<typename _Tp>
template<integral _Tp>
[[nodiscard]]
constexpr enable_if_t<is_integral<_Tp>::value, _Tp>
constexpr _Tp
byteswap(_Tp __value) noexcept
{
if constexpr (sizeof(_Tp) == 1)
Expand Down Expand Up @@ -378,54 +379,53 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __cpp_lib_bitops // C++ >= 20

/// @cond undocumented
template<typename _Tp, typename _Up = _Tp>
using _If_is_unsigned_integer
= enable_if_t<__is_unsigned_integer<_Tp>::value, _Up>;
template<typename _Tp>
concept __unsigned_integer = __is_unsigned_integer<_Tp>::value;
/// @endcond

// [bit.rot], rotating

/// Rotate `x` to the left by `s` bits.
template<typename _Tp>
[[nodiscard]] constexpr _If_is_unsigned_integer<_Tp>
template<__unsigned_integer _Tp>
[[nodiscard]] constexpr _Tp
rotl(_Tp __x, int __s) noexcept
{ return std::__rotl(__x, __s); }

/// Rotate `x` to the right by `s` bits.
template<typename _Tp>
[[nodiscard]] constexpr _If_is_unsigned_integer<_Tp>
template<__unsigned_integer _Tp>
[[nodiscard]] constexpr _Tp
rotr(_Tp __x, int __s) noexcept
{ return std::__rotr(__x, __s); }

// [bit.count], counting

/// The number of contiguous zero bits, starting from the highest bit.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int>
template<__unsigned_integer _Tp>
constexpr int
countl_zero(_Tp __x) noexcept
{ return std::__countl_zero(__x); }

/// The number of contiguous one bits, starting from the highest bit.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int>
template<__unsigned_integer _Tp>
constexpr int
countl_one(_Tp __x) noexcept
{ return std::__countl_one(__x); }

/// The number of contiguous zero bits, starting from the lowest bit.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int>
template<__unsigned_integer _Tp>
constexpr int
countr_zero(_Tp __x) noexcept
{ return std::__countr_zero(__x); }

/// The number of contiguous one bits, starting from the lowest bit.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int>
template<__unsigned_integer _Tp>
constexpr int
countr_one(_Tp __x) noexcept
{ return std::__countr_one(__x); }

/// The number of bits set in `x`.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int>
template<__unsigned_integer _Tp>
constexpr int
popcount(_Tp __x) noexcept
{ return std::__popcount(__x); }
#endif // __cpp_lib_bitops
Expand All @@ -434,28 +434,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// [bit.pow.two], integral powers of 2

/// True if `x` is a power of two, false otherwise.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, bool>
template<__unsigned_integer _Tp>
constexpr bool
has_single_bit(_Tp __x) noexcept
{ return std::__has_single_bit(__x); }

/// The smallest power-of-two not less than `x`.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp>
template<__unsigned_integer _Tp>
constexpr _Tp
bit_ceil(_Tp __x) noexcept
{ return std::__bit_ceil(__x); }

/// The largest power-of-two not greater than `x`.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp>
template<__unsigned_integer _Tp>
constexpr _Tp
bit_floor(_Tp __x) noexcept
{ return std::__bit_floor(__x); }

// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3656. Inconsistent bit operations returning a count
/// The smallest integer greater than the base-2 logarithm of `x`.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int>
template<__unsigned_integer _Tp>
constexpr int
bit_width(_Tp __x) noexcept
{ return std::__bit_width(__x); }
#endif // defined (__cpp_lib_int_pow2)
Expand Down
Loading

0 comments on commit 66d5c13

Please sign in to comment.