pstore2
Functions
bit_count.hpp File Reference

Implements portable functions for bit twiddling operations including counting leading and trailing zero bits as well as population count. More...

#include "pstore/support/uint128.hpp"
Include dependency graph for bit_count.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

constexpr unsigned pstore::bit_count::pop_count (unsigned char const x) noexcept
 
constexpr unsigned pstore::bit_count::pop_count (unsigned short const x) noexcept
 
constexpr unsigned pstore::bit_count::pop_count (unsigned const x) noexcept
 
constexpr unsigned pstore::bit_count::pop_count (unsigned long const x) noexcept
 
constexpr unsigned pstore::bit_count::pop_count (unsigned long long const x) noexcept
 
constexpr unsigned pstore::bit_count::pop_count (uint128 const x) noexcept
 
constexpr unsigned pstore::bit_count::clz (unsigned const x) noexcept
 
constexpr unsigned pstore::bit_count::clz (unsigned long const x) noexcept
 
constexpr unsigned pstore::bit_count::clz (unsigned long long const x) noexcept
 
constexpr unsigned pstore::bit_count::clz (std::uint8_t const x) noexcept
 
constexpr unsigned pstore::bit_count::clz (std::uint16_t const x) noexcept
 
constexpr unsigned pstore::bit_count::clz (uint128 const x) noexcept
 
constexpr unsigned pstore::bit_count::ctz (unsigned long long const x) noexcept
 
constexpr unsigned pstore::bit_count::ctz (uint128 const x) noexcept
 

Detailed Description

Implements portable functions for bit twiddling operations including counting leading and trailing zero bits as well as population count.

Function Documentation

◆ clz()

constexpr unsigned pstore::bit_count::clz ( unsigned const  x)
noexcept

Count the number of contiguous zero bits starting from the MSB. It is undefined behavior if x is 0.

◆ ctz()

constexpr unsigned pstore::bit_count::ctz ( unsigned long long const  x)
noexcept

Count the number of contiguous zero bits starting from the LSB. It is undefined behavior if x is 0.