Commit 27e6c1f4 by Jonathan Wakely Committed by Jonathan Wakely

Add Doxygen comments to <bit> header

	* include/std/bit: Add Doxygen comments.

From-SVN: r273938
parent 949fdadb
2019-07-31 Jonathan Wakely <jwakely@redhat.com> 2019-07-31 Jonathan Wakely <jwakely@redhat.com>
* include/std/bit: Add Doxygen comments.
PR libstdc++/91308 PR libstdc++/91308
* include/bits/unique_ptr.h (unique_ptr::__safe_conversion_up): Remove * include/bits/unique_ptr.h (unique_ptr::__safe_conversion_up): Remove
constraints on deleter that should only apply to the constructor. constraints on deleter that should only apply to the constructor.
......
...@@ -40,6 +40,17 @@ namespace std _GLIBCXX_VISIBILITY(default) ...@@ -40,6 +40,17 @@ namespace std _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup bit_manip Bit manipulation
* @ingroup numerics
*
* Utilities for examining and manipulating individual bits.
*
* @{
*/
/// @cond undoc
template<typename _Tp> template<typename _Tp>
constexpr _Tp constexpr _Tp
__rotl(_Tp __x, int __s) noexcept __rotl(_Tp __x, int __s) noexcept
...@@ -248,19 +259,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -248,19 +259,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _Nd - std::__countl_zero(__x); return _Nd - std::__countl_zero(__x);
} }
/// @endcond
#if __cplusplus > 201703L #if __cplusplus > 201703L
/// @cond undoc
template<typename _Tp, typename _Up = _Tp> template<typename _Tp, typename _Up = _Tp>
using _If_is_unsigned_integer using _If_is_unsigned_integer
= enable_if_t<__is_unsigned_integer<_Tp>::value, _Up>; = enable_if_t<__is_unsigned_integer<_Tp>::value, _Up>;
/// @endcond
// [bit.rot], rotating // [bit.rot], rotating
/// Rotate `x` to the left by `s` bits.
template<typename _Tp> template<typename _Tp>
[[nodiscard]] constexpr _If_is_unsigned_integer<_Tp> [[nodiscard]] constexpr _If_is_unsigned_integer<_Tp>
rotl(_Tp __x, int __s) noexcept rotl(_Tp __x, int __s) noexcept
{ return std::__rotl(__x, __s); } { return std::__rotl(__x, __s); }
/// Rotate `x` to the right by `s` bits.
template<typename _Tp> template<typename _Tp>
[[nodiscard]] constexpr _If_is_unsigned_integer<_Tp> [[nodiscard]] constexpr _If_is_unsigned_integer<_Tp>
rotr(_Tp __x, int __s) noexcept rotr(_Tp __x, int __s) noexcept
...@@ -268,26 +285,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -268,26 +285,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// [bit.count], counting // [bit.count], counting
/// The number of contiguous zero bits, starting from the highest bit.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int> constexpr _If_is_unsigned_integer<_Tp, int>
countl_zero(_Tp __x) noexcept countl_zero(_Tp __x) noexcept
{ return std::__countl_zero(__x); } { return std::__countl_zero(__x); }
/// The number of contiguous one bits, starting from the highest bit.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int> constexpr _If_is_unsigned_integer<_Tp, int>
countl_one(_Tp __x) noexcept countl_one(_Tp __x) noexcept
{ return std::__countl_one(__x); } { return std::__countl_one(__x); }
/// The number of contiguous zero bits, starting from the lowest bit.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int> constexpr _If_is_unsigned_integer<_Tp, int>
countr_zero(_Tp __x) noexcept countr_zero(_Tp __x) noexcept
{ return std::__countr_zero(__x); } { return std::__countr_zero(__x); }
/// The number of contiguous one bits, starting from the lowest bit.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int> constexpr _If_is_unsigned_integer<_Tp, int>
countr_one(_Tp __x) noexcept countr_one(_Tp __x) noexcept
{ return std::__countr_one(__x); } { return std::__countr_one(__x); }
/// The number of bits set in `x`.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, int> constexpr _If_is_unsigned_integer<_Tp, int>
popcount(_Tp __x) noexcept popcount(_Tp __x) noexcept
...@@ -295,21 +317,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -295,21 +317,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// [bit.pow.two], integral powers of 2 // [bit.pow.two], integral powers of 2
/// True if `x` is a power of two, false otherwise.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, bool> constexpr _If_is_unsigned_integer<_Tp, bool>
ispow2(_Tp __x) noexcept ispow2(_Tp __x) noexcept
{ return std::__ispow2(__x); } { return std::__ispow2(__x); }
/// The smallest power-of-two not less than `x`.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp> constexpr _If_is_unsigned_integer<_Tp>
ceil2(_Tp __x) noexcept ceil2(_Tp __x) noexcept
{ return std::__ceil2(__x); } { return std::__ceil2(__x); }
/// The largest power-of-two not greater than `x`.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp> constexpr _If_is_unsigned_integer<_Tp>
floor2(_Tp __x) noexcept floor2(_Tp __x) noexcept
{ return std::__floor2(__x); } { return std::__floor2(__x); }
/// The smallest integer greater than the base-2 logarithm of `x`.
template<typename _Tp> template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp> constexpr _If_is_unsigned_integer<_Tp>
log2p1(_Tp __x) noexcept log2p1(_Tp __x) noexcept
...@@ -326,6 +352,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -326,6 +352,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}; };
#endif // C++2a #endif // C++2a
/// @}
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std } // namespace std
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment