名前空間
変種
操作

標準ライブラリヘッダー <bit> (C++20)

From cppreference.com
 
 
標準ライブラリヘッダー
 

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

(C++20)
スカラ型のエンディアンを示す
(列挙型) [編集]

関数

(C++20)
ある型のオブジェクト表現を別の型のオブジェクト表現として再解釈する
(関数テンプレート) [編集]
(C++23)
与えられた整数値のバイト順を反転する
(関数テンプレート) [編集]
数値が2の整数乗であるかチェックする
(関数テンプレート) [編集]
(C++20)
与えられた値以上の最小の2の整数乗を求める
(関数テンプレート) [編集]
(C++20)
与えられた値以下の最大の2の整数乗を求める
(関数テンプレート) [編集]
(C++20)
与えられた値を表現するために必要な最小のビット数を求める
(関数テンプレート) [編集]
(C++20)
ビット単位の左ローテートの結果を計算する
(関数テンプレート) [編集]
(C++20)
ビット単位の右ローテートの結果を計算する
(関数テンプレート) [編集]
最上位ビットから始まる連続した0ビットの数を数える
(関数テンプレート) [編集]
最上位ビットから始まる連続した1ビットの数を数える
(関数テンプレート) [編集]
最下位ビットから始まる連続した0ビットの数を数える
(関数テンプレート) [編集]
最下位ビットから始まる連続した1ビットの数を数える
(関数テンプレート) [編集]
(C++20)
符号なし整数内の1ビットの数を数える
(関数テンプレート) [編集]

[編集] 概要

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;
 
  // 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;
 
  // endian
  enum class endian {
    little = /* see description */,
    big    = /* see description */,
    native = /* see description */
  };
}
English 日本語 中文(简体) 中文(繁體)