Standard library header <bit> (C++20)
From ko.cppreference.net
C++
Standard library headers
이 헤더는 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 */
};
}