標準庫標頭檔案 <bit> (C++20)
來自 cppreference.com
此標頭檔案是 numeric 庫的一部分。
型別 | |
(C++20) |
指示標量型別的位元組序 (列舉) |
函式 | |
(C++20) |
將一種型別的物件表示重新解釋為另一種型別的物件表示 (函式模板) |
(C++23) |
反轉給定整數值中的位元組 (函式模板) |
(C++20) |
檢查一個數是否是 2 的整數次冪 (函式模板) |
(C++20) |
查詢不小於給定值的最小 2 的整數冪 (函式模板) |
(C++20) |
查詢不大於給定值的最大 2 的整數冪 (函式模板) |
(C++20) |
查詢表示給定值所需的最小位數 (函式模板) |
(C++20) |
計算按位左旋的結果 (函式模板) |
(C++20) |
計算位右旋的結果 (函式模板) |
(C++20) |
計算從最高有效位開始的連續 0 位的數量 (函式模板) |
(C++20) |
計算從最高有效位開始的連續 1 位的數量 (函式模板) |
(C++20) |
計算從最低有效位開始的連續 0 位的數量 (函式模板) |
(C++20) |
從最低有效位開始,計算連續的 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 */ }; }