LLVM 20.0.0git
Classes | Namespaces | Enumerations | Functions
bit.h File Reference

This file implements the C++20 <bit> header. More...

#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <limits>
#include <type_traits>
#include <cstring>
#include <machine/endian.h>

Go to the source code of this file.

Classes

struct  llvm::detail::TrailingZerosCounter< T, SizeOfT >
 
struct  llvm::detail::LeadingZerosCounter< T, SizeOfT >
 
struct  llvm::detail::PopulationCounter< T, SizeOfT >
 
struct  llvm::detail::PopulationCounter< T, 8 >
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::detail
 These are wrappers over isa* function that allow them to be used in generic algorithms such as llvm:all_of, llvm::none_of, etc.
 

Enumerations

enum class  llvm::endianness { llvm::big , llvm::little , llvm::native = little }
 

Functions

template<typename To , typename From , typename = std::enable_if_t<sizeof(To) == sizeof(From)>, typename = std::enable_if_t<std::is_trivially_constructible<To>::value>, typename = std::enable_if_t<std::is_trivially_copyable<To>::value>, typename = std::enable_if_t<std::is_trivially_copyable<From>::value>>
To llvm::bit_cast (const From &from) noexcept
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
constexpr T llvm::byteswap (T V) noexcept
 Reverses the bytes in the given integer value V.
 
template<typename T , typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr bool llvm::has_single_bit (T Value) noexcept
 
template<typename T >
int llvm::countr_zero (T Val)
 Count number of 0's from the least significant bit to the most stopping at the first 1.
 
template<typename T >
int llvm::countl_zero (T Val)
 Count number of 0's from the most significant bit to the least stopping at the first 1.
 
template<typename T >
int llvm::countl_one (T Value)
 Count the number of ones from the most significant bit to the first zero bit.
 
template<typename T >
int llvm::countr_one (T Value)
 Count the number of ones from the least significant bit to the first zero bit.
 
template<typename T >
int llvm::bit_width (T Value)
 Returns the number of bits needed to represent Value if Value is nonzero.
 
template<typename T >
T llvm::bit_floor (T Value)
 Returns the largest integral power of two no greater than Value if Value is nonzero.
 
template<typename T >
T llvm::bit_ceil (T Value)
 Returns the smallest integral power of two no smaller than Value if Value is nonzero.
 
template<typename T , typename = std::enable_if_t<std::is_unsigned_v<T>>>
int llvm::popcount (T Value) noexcept
 Count the number of set bits in a value.
 
template<typename T , typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr T llvm::rotr (T V, int R)
 
template<typename T , typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr T llvm::rotl (T V, int R)
 

Detailed Description

This file implements the C++20 <bit> header.

Definition in file bit.h.