Standard library header <bit> (C++20)
From ja.cppreference.net
このヘッダは numeric ライブラリの一部です。
型 |
|
|
(C++20)
|
スカラ型のエンディアンを示す
(列挙型) |
関数 | |
(C++20) |
ある型のオブジェクト表現を別の型のものとして解釈する (関数テンプレート) |
(C++23) |
指定された整数値のバイトを逆順にする (関数テンプレート) |
(C++20) |
数が2の整数乗かどうかを調べる2 (関数テンプレート) |
(C++20) |
指定された値以上で最小の2の整数乗を見つける (関数テンプレート) |
(C++20) |
指定された値以下で最大の2の整数乗を見つける (関数テンプレート) |
(C++20) |
指定された値を表現するために必要な最小のビット数を見つける (関数テンプレート) |
(C++29) |
未定義動作の可能性なく左シフトする (関数テンプレート) |
(C++29) |
未定義動作の可能性なく右シフトする (関数テンプレート) |
(C++20) |
ビット単位の左ローテーションの結果を計算する (関数テンプレート) |
(C++20) |
ビット単位の右ローテーションの結果を計算する (関数テンプレート) |
(C++20) |
最上位ビットから、連続する0ビットの数を数える(関数テンプレート) |
(C++20) |
最上位ビットから、連続する1ビットの数を数える(関数テンプレート) |
(C++20) |
最下位ビットから、連続する0ビットの数を数える(関数テンプレート) |
(C++20) |
最下位ビットから、連続する1ビットの数を数える(関数テンプレート) |
(C++20) |
符号なし整数の中の1ビットの数を数える(関数テンプレート) |
(C++29) |
整数のビットを逆順にする (関数テンプレート) |
(C++29) |
指定された長さのビットパターンを繰り返す/ブロードキャストする (関数テンプレート) |
(C++29) |
マスクを使用してオペランドのビットを圧縮する (PEXT) (関数テンプレート) |
(C++29) |
マスクを使用してオペランドからビットを展開する (PDEP) (関数テンプレート) |
概要
namespace std {
// bit_cast
template<class To, class From>
constexpr To bit_cast(const From& from) noexcept;
// byteswap
template <class T>
constexpr T byteswap(T value) noexcept;
// integral powers of 2
template<class T>
constexpr bool has_single_bit(T x) noexcept;
template<class T>
constexpr T bit_ceil(T x);
template<class T>
constexpr T bit_floor(T x) noexcept;
template<class T>
constexpr int bit_width(T x) noexcept;
// shifting
template<class T, class S>
constexpr T shl(T x, S s) noexcept;
template<class T, class S>
constexpr T shr(T x, S s) noexcept;
// rotating
template<class T>
constexpr T rotl(T x, int s) noexcept;
template<class T>
constexpr T rotr(T x, int s) noexcept;
// counting
template<class T>
constexpr int countl_zero(T x) noexcept;
template<class T>
constexpr int countl_one(T x) noexcept;
template<class T>
constexpr int countr_zero(T x) noexcept;
template<class T>
constexpr int countr_one(T x) noexcept;
template<class T>
constexpr int popcount(T x) noexcept;
// permutation
template<class T>
constexpr T bit_reverse(T x) noexcept;
template<class T>
constexpr T bit_repeat(T x, int l);
template<class T>
constexpr T bit_compress(T x, T m) noexcept;
template<class T>
constexpr T bit_expand(T x, T m) noexcept;
// endian
enum class endian {
little = /* see description */,
big = /* see description */,
native = /* see description */
};
}