cppx-core
bits_per_.hpp
Go to the documentation of this file.
1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi").
2 
8 #include <cppx-core/language/syntax/macro-use.hpp> // CPPX_USE_CPPX
9 
10 #include <c/limits.hpp> // CHAR_BIT
11 #include <limits> // std::numeric_limits
12 
13 namespace cppx
14 {
15  CPPX_USE_STD( numeric_limits );
16 
18  const int bits_per_byte = CHAR_BIT;
19 
21  template< class Type >
22  constexpr int bits_per_ = sizeof( Type )*bits_per_byte;
23 
29  template< class Type >
30  constexpr int magnitude_bits_per_ = numeric_limits<Type>::digits;
31 
32  namespace bitlevel
33  {
35  } // namespace bitlevel
36 } // namespace cppx
constexpr int bits_per_
The number of bits per object/value of the specified type.
Definition: bits_per_.hpp:22
constexpr int magnitude_bits_per_
The number of bits that determine the magnitude, i.e. the number of value representation bits minus a...
Definition: bits_per_.hpp:30
CPPX_USE_CPPX(bits_per_, magnitude_bits_per_)
const int bits_per_byte
Usually 8, but e.g. 16 on some DSPs.
Definition: bits_per_.hpp:18
CPPX_USE_STD(basic_string, basic_string_view, bitset, char_traits, size)
Macros for generating more concise and clear using statements, primarily $use_cppx and $use_std,...