Namespaces
Variants

Standard library header <bit> (C++20)

From cppreference.net
Standard library headers

이 헤더는 numeric 라이브러리의 일부입니다.

타입

(C++20)
스칼라 타입의 엔디언을 나타냄
(열거형)

함수

(C++20)
한 타입의 객체 표현을 다른 타입의 객체 표현으로 재해석함
(함수 템플릿)
(C++23)
주어진 정수 값의 바이트 순서를 반전시킴
(함수 템플릿)
숫자가 2 의 정수 거듭제곱인지 확인함
(함수 템플릿)
(C++20)
주어진 값보다 작지 않은 가장 작은 2 의 정수 거듭제곱을 찾음
(함수 템플릿)
(C++20)
주어진 값보다 크지 않은 가장 큰 2 의 정수 거듭제곱을 찾음
(함수 템플릿)
(C++20)
주어진 값을 표현하는 데 필요한 최소 비트 수를 찾음
(함수 템플릿)
(C++20)
비트 왼쪽 회전 결과를 계산함
(함수 템플릿)
(C++20)
비트 오른쪽 회전 결과를 계산함
(함수 템플릿)
최상위 비트부터 시작하여 연속된 0 비트 수를 셈
(함수 템플릿)
(C++20)
최상위 비트부터 시작하여 연속된 1 비트 수를 셈
(함수 템플릿)
최하위 비트부터 시작하여 연속된 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;
  // 정수 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;
  // 회전
  template<class T>
    constexpr T rotl(T x, int s) noexcept;
  template<class T>
    constexpr T rotr(T x, int s) noexcept;
  // 카운팅
  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;
  // 엔디안
  enum class endian {
    little = /* 설명 참조 */,
    big    = /* 설명 참조 */,
    native = /* 설명 참조 */
  };
}