名前空間
変種
操作

標準ライブラリヘッダ <bit>

提供: cppreference.com
< cpp‎ | header
 
 
 

このヘッダは数値演算ライブラリの一部です。

[編集] 関数

(C++20)
ある型のオブジェクト表現を別の型のオブジェクト表現として再解釈します
(関数テンプレート) [edit]
数値が2の整数乗かどうか調べます
(関数テンプレート) [edit]
(C++20)
指定された値より小さくない最も小さな2の整数乗を求めます
(関数テンプレート) [edit]
(C++20)
指定された値より大きくない最も大きな2の整数乗を求めます
(関数テンプレート) [edit]
(C++20)
指定された値を表現するために必要な最小のビット数を求めます
(関数テンプレート) [edit]
(C++20)
ビット単位の左ローテートの結果を計算します
(関数テンプレート) [edit]
(C++20)
ビット単位の右ローテートの結果を計算します
(関数テンプレート) [edit]
最上位ビットから連続する0のビットの数を数えます
(関数テンプレート) [edit]
最上位ビットから連続する1のビットの数を数えます
(関数テンプレート) [edit]
最下位ビットから連続する0のビットの数を数えます
(関数テンプレート) [edit]
最下位ビットから連続する1のビットの数を数えます
(関数テンプレート) [edit]
(C++20)
符号なし整数の1のビットの数を数えます
(関数テンプレート) [edit]

[編集]

(C++20)
スカラー型のエンディアンを表します
(列挙) [edit]

[編集] 概要

namespace std {
    // bit_cast
    template<class To, class From>
    constexpr To bit_cast(const From& from) 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 T bit_width(T x) noexcept;
 
    // rotating
    template<class T>
    [[nodiscard]] constexpr T rotl(T x, int s) noexcept;
    template<class T>
    [[nodiscard]] 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;
 
    // endian
    enum class endian {
        little = /*implementation-defined*/,
        big    = /*implementation-defined*/,
        native = /*implementation-defined*/
    };
}