10b57cec5SDimitry Andric// -*- C++ -*- 2349cc55cSDimitry Andric//===----------------------------------------------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===---------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPP_BIT 110b57cec5SDimitry Andric#define _LIBCPP_BIT 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric/* 140b57cec5SDimitry Andric bit synopsis 150b57cec5SDimitry Andric 160b57cec5SDimitry Andricnamespace std { 17349cc55cSDimitry Andric // [bit.cast], bit_cast 18349cc55cSDimitry Andric template<class To, class From> 19349cc55cSDimitry Andric constexpr To bit_cast(const From& from) noexcept; // C++20 200b57cec5SDimitry Andric 214824e7fdSDimitry Andric // [bit.byteswap], byteswap 224824e7fdSDimitry Andric template<class T> 234824e7fdSDimitry Andric constexpr T byteswap(T value) noexcept; // C++23 244824e7fdSDimitry Andric 255ffd83dbSDimitry Andric // [bit.pow.two], integral powers of 2 260b57cec5SDimitry Andric template <class T> 27e8d8bef9SDimitry Andric constexpr bool has_single_bit(T x) noexcept; // C++20 280b57cec5SDimitry Andric template <class T> 29e8d8bef9SDimitry Andric constexpr T bit_ceil(T x); // C++20 300b57cec5SDimitry Andric template <class T> 31e8d8bef9SDimitry Andric constexpr T bit_floor(T x) noexcept; // C++20 320b57cec5SDimitry Andric template <class T> 3381ad6265SDimitry Andric constexpr int bit_width(T x) noexcept; // C++20 340b57cec5SDimitry Andric 355ffd83dbSDimitry Andric // [bit.rotate], rotating 360b57cec5SDimitry Andric template<class T> 370b57cec5SDimitry Andric constexpr T rotl(T x, unsigned int s) noexcept; // C++20 380b57cec5SDimitry Andric template<class T> 390b57cec5SDimitry Andric constexpr T rotr(T x, unsigned int s) noexcept; // C++20 400b57cec5SDimitry Andric 415ffd83dbSDimitry Andric // [bit.count], counting 420b57cec5SDimitry Andric template<class T> 430b57cec5SDimitry Andric constexpr int countl_zero(T x) noexcept; // C++20 440b57cec5SDimitry Andric template<class T> 450b57cec5SDimitry Andric constexpr int countl_one(T x) noexcept; // C++20 460b57cec5SDimitry Andric template<class T> 470b57cec5SDimitry Andric constexpr int countr_zero(T x) noexcept; // C++20 480b57cec5SDimitry Andric template<class T> 490b57cec5SDimitry Andric constexpr int countr_one(T x) noexcept; // C++20 500b57cec5SDimitry Andric template<class T> 510b57cec5SDimitry Andric constexpr int popcount(T x) noexcept; // C++20 520b57cec5SDimitry Andric 535ffd83dbSDimitry Andric // [bit.endian], endian 54e40139ffSDimitry Andric enum class endian { 55e40139ffSDimitry Andric little = see below, // C++20 56e40139ffSDimitry Andric big = see below, // C++20 57e40139ffSDimitry Andric native = see below // C++20 58e40139ffSDimitry Andric }; 59e40139ffSDimitry Andric 600b57cec5SDimitry Andric} // namespace std 610b57cec5SDimitry Andric 620b57cec5SDimitry Andric*/ 630b57cec5SDimitry Andric 6481ad6265SDimitry Andric#include <__assert> // all public C++ headers provide the assertion handler 65349cc55cSDimitry Andric#include <__bit/bit_cast.h> 66bdd1243dSDimitry Andric#include <__bit/bit_ceil.h> 67bdd1243dSDimitry Andric#include <__bit/bit_floor.h> 68bdd1243dSDimitry Andric#include <__bit/bit_log2.h> 69bdd1243dSDimitry Andric#include <__bit/bit_width.h> 70bdd1243dSDimitry Andric#include <__bit/blsr.h> 714824e7fdSDimitry Andric#include <__bit/byteswap.h> 72bdd1243dSDimitry Andric#include <__bit/countl.h> 73bdd1243dSDimitry Andric#include <__bit/countr.h> 74bdd1243dSDimitry Andric#include <__bit/endian.h> 75bdd1243dSDimitry Andric#include <__bit/has_single_bit.h> 76bdd1243dSDimitry Andric#include <__bit/popcount.h> 77bdd1243dSDimitry Andric#include <__bit/rotate.h> 78349cc55cSDimitry Andric#include <__config> 790b57cec5SDimitry Andric#include <version> 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 820b57cec5SDimitry Andric# pragma GCC system_header 830b57cec5SDimitry Andric#endif 840b57cec5SDimitry Andric 85bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 86*06c3fb27SDimitry Andric# include <cstdlib> 87bdd1243dSDimitry Andric# include <iosfwd> 88bdd1243dSDimitry Andric# include <limits> 89bdd1243dSDimitry Andric# include <type_traits> 90e40139ffSDimitry Andric#endif 910b57cec5SDimitry Andric 920b57cec5SDimitry Andric#endif // _LIBCPP_BIT 93