C++ Library Extensions 2022.12.09
To help learn modern C++ programming
tpf_bitwise.hpp File Reference
#include <iostream>
#include <type_traits>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
#include <cstddef>
#include <bitset>
#include <cmath>
Include dependency graph for tpf_bitwise.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tpf::bitwise::hidden::st_is_character< T >
 
struct  tpf::bitwise::hidden::st_is_character< char >
 
struct  tpf::bitwise::hidden::st_is_character< unsigned char >
 
struct  tpf::bitwise::hidden::st_is_character< signed char >
 
struct  tpf::bitwise::hidden::st_is_character< wchar_t >
 
struct  tpf::bitwise::bit_pattern< T, typename >
 

Namespaces

namespace  tpf
 Includes subnamespace conversion.
 
namespace  tpf::bitwise
 
namespace  tpf::bitwise::hidden
 

Macros

#define TBB_SUPPRESS_DEPRECATED_MESSAGES   1
 
#define NOMINMAX
 
#define Tpf_SignedCommonType(a, b)   tpf::bitwise::signed_common_t<decltype(a), decltype(b)>
 
#define Tpf_UnignedCommonType(a, b)   tpf::bitwise::unsigned_common_t<decltype(a), decltype(b)>
 

Typedefs

template<typename T >
using tpf::bitwise::enable_if_integral = std::enable_if_t< std::is_integral< T >::value >
 
template<typename T , typename = enable_if_integral<T>>
using tpf::bitwise::unsigned_t = std::make_unsigned_t< T >
 
template<typename T , typename = enable_if_integral<T>>
using tpf::bitwise::signed_t = std::make_signed_t< T >
 
template<typename S , typename T >
using tpf::bitwise::common_t = std::common_type_t< S, T >
 
template<typename S , typename T , typename = enable_if_integral<S>, typename = enable_if_integral<T>>
using tpf::bitwise::signed_common_t = signed_t< common_t< S, T > >
 
template<typename S , typename T , typename = enable_if_integral<S>, typename = enable_if_integral<T>>
using tpf::bitwise::unsigned_common_t = unsigned_t< common_t< S, T > >
 

Functions

template<typename T , typename = enable_if_integral<T>>
int tpf::bitwise::count_set_bits (T bits)
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::to_bits (T bits)
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::to_hex (T v)
 
template<typename T , std::size_t N>
std::string tpf::bitwise::to_hex_reverse (T(&v)[N])
 
template<typename T , std::size_t N>
std::string tpf::bitwise::to_hex (T(&v)[N])
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::to_dec (T v)
 
template<typename T , std::size_t N>
std::string tpf::bitwise::to_dec_reverse (T(&v)[N])
 
template<typename T , std::size_t N>
std::string tpf::bitwise::to_dec (T(&v)[N])
 
template<typename T , typename = enable_if_integral<T>>
int tpf::bitwise::field_with (T v)
 
template<typename T , typename = enable_if_integral<T>>
int tpf::bitwise::numeric_width ()
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::to_dec_width (T v)
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::numeric_base (T v)
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::numeric_type_info ()
 
template<typename = void>
std::string tpf::bitwise::integral_type_info ()
 
template<typename T , typename = enable_if_integral<T>>
std::string tpf::bitwise::twos_complement (T c)
 

Variables

template<typename T >
constexpr bool tpf::bitwise::is_char_v = hidden::st_is_character<T>::value
 
template<typename T >
constexpr T tpf::bitwise::limits_max = std::numeric_limits<T>::max()
 
template<typename T >
constexpr T tpf::bitwise::limits_min = std::numeric_limits<T>::min()
 
template<typename T >
constexpr int tpf::bitwise::sizeof_bits = sizeof(T) * 8
 
template<typename T >
constexpr unsigned_t< T > tpf::bitwise::high_bit_mask = unsigned_t<T>(1) << (sizeof_bits<T>-1)
 

Macro Definition Documentation

◆ NOMINMAX

#define NOMINMAX

Definition at line 9 of file tpf_bitwise.hpp.

◆ TBB_SUPPRESS_DEPRECATED_MESSAGES

#define TBB_SUPPRESS_DEPRECATED_MESSAGES   1

Definition at line 5 of file tpf_bitwise.hpp.

◆ Tpf_SignedCommonType

#define Tpf_SignedCommonType (   a,
 
)    tpf::bitwise::signed_common_t<decltype(a), decltype(b)>

Definition at line 414 of file tpf_bitwise.hpp.

◆ Tpf_UnignedCommonType

#define Tpf_UnignedCommonType (   a,
 
)    tpf::bitwise::unsigned_common_t<decltype(a), decltype(b)>

Definition at line 415 of file tpf_bitwise.hpp.