ATLAS Offline Software
Namespaces | Functions
bitscan.h File Reference

Bit scanning functions. More...

#include "CxxUtils/features.h"
#include <climits>
#include <cstdint>
#include <type_traits>
Include dependency graph for bitscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 CxxUtils
 
 CxxUtils::detail
 Portable implementations.
 

Functions

template<typename T >
constexpr unsigned CxxUtils::detail::ctz_portable (T x)
 
template<typename T >
constexpr unsigned CxxUtils::detail::clz_portable (T x)
 
template<typename T >
constexpr unsigned CxxUtils::detail::popcount_portable (T x)
 
constexpr unsigned CxxUtils::count_trailing_zeros (unsigned x)
 Count number of trailing zeros. More...
 
constexpr unsigned CxxUtils::count_trailing_zeros (unsigned long x)
 
constexpr unsigned CxxUtils::count_trailing_zeros (unsigned long long x)
 
constexpr unsigned CxxUtils::count_leading_zeros (unsigned x)
 Count number of leading zeros. More...
 
constexpr unsigned CxxUtils::count_leading_zeros (unsigned long x)
 
constexpr unsigned CxxUtils::count_leading_zeros (unsigned long long x)
 
constexpr unsigned CxxUtils::count_ones (unsigned x)
 Count number of set bits. More...
 
constexpr unsigned CxxUtils::count_ones (unsigned long x)
 
constexpr unsigned CxxUtils::count_ones (unsigned long long x)
 
template<typename T >
constexpr int CxxUtils::maxSetBit (const T x)
 Returns the position (counting from least-significant-bit=0) of the most significant set bit. More...
 

Detailed Description

Bit scanning functions.

Author
Frank Winklmeier Fast helper functions to count number of leading/trailing zeros. Supports 32 and 64 bit input types.

Inspired by boost/multiprecision/detail/bitscan.hpp https://en.wikipedia.org/wiki/Find_first_set

Definition in file bitscan.h.