23template<
typename T, 
unsigned LSB, 
unsigned MSB>
 
   27  typedef remove_reference_t<T> Base_type;
 
   29  static_assert(MSB >= LSB, 
"boundary mismatch in bit-field definition");
 
   30  static_assert(MSB < 
sizeof(Base_type) * 8, 
"MSB outside of bit-field type");
 
   31  static_assert(LSB < 
sizeof(Base_type) * 8, 
"LSB outside of bit-field type");
 
   38  template<
unsigned BITS> 
struct Best_type
 
   40    template< 
typename TY > 
struct Cmp { 
enum { value = (BITS <= 
sizeof(TY)*8) }; };
 
   41    typedef cxx::type_list<
 
   48    typedef cxx::find_type_t<Unsigned_types, Cmp> Type;
 
   63    Low_mask = 
static_cast<Base_type
>(~0ULL) >> (
sizeof(Base_type)*8 - 
Bits),
 
 
   85  static_assert(
sizeof(
Bits_type)*8 >= 
Bits, 
"error finding the type to store the bits");
 
   86  static_assert(
sizeof(
Shift_type)*8 >= 
Bits + 
Lsb, 
"error finding the type to keep the shifted bits");
 
   87  static_assert(
sizeof(
Bits_type) <= 
sizeof(Base_type), 
"size mismatch for Bits_type");
 
   88  static_assert(
sizeof(
Shift_type) <= 
sizeof(Base_type), 
"size mismatch for Shift_type");
 
   89  static_assert(
sizeof(
Bits_type) <= 
sizeof(
Shift_type), 
"size mismatch for Shift_type and Bits_type");
 
  209  template< 
typename TT >
 
  216    constexpr Value_base(TT t) : v(t) {}
 
 
  227  template< 
typename TT >
 
  228  class Value : 
public Value_base<TT>
 
  231    constexpr Value(TT t) : Value_base<TT>(t) {}
 
  232    constexpr operator Bits_type ()
 const { 
return this->get(); }
 
  233    constexpr Value &operator = (
Bits_type val) { this->set(
val); 
return *
this; }
 
  234    constexpr Value &operator = (Value 
const &
val)
 
  235    { this->set(
val.get()); 
return *
this; }
 
  236    Value(Value 
const &) = 
default;
 
 
  240  template< 
typename TT >
 
  241  class Value_unshifted : 
public Value_base<TT>
 
  244    constexpr Value_unshifted(TT t) : Value_base<TT>(t) {}
 
  245    constexpr operator Shift_type ()
 const { 
return this->get_unshifted(); }
 
  246    constexpr Value_unshifted &operator = (
Shift_type val) { this->set_unshifted(
val); 
return *
this; }
 
  247    constexpr Value_unshifted &operator = (Value_unshifted 
const &
val)
 
  248    { this->set_unshifted(
val.get_unshifted()); 
return *
this; }
 
  249    Value_unshifted(Value_unshifted 
const &) = 
default;
 
 
  253  typedef Value<Base_type &> 
Ref;
 
  257  typedef Value<Base_type const> 
Val;
 
 
  267#define CXX_BITFIELD_MEMBER(LSB, MSB, name, data_member) \ 
  270  typedef cxx::Bitfield<decltype(data_member), LSB, MSB> name ## _bfm_t; \ 
  272  constexpr typename name ## _bfm_t::Val name() const { return data_member; } \ 
  273  typename name ## _bfm_t::Val name() const volatile { return data_member; } \ 
  275  constexpr typename name ## _bfm_t::Ref name() { return data_member; } \ 
  276  typename name ## _bfm_t::Ref_volatile name() volatile { return data_member; } \ 
  279#define CXX_BITFIELD_MEMBER_RO(LSB, MSB, name, data_member) \ 
  282  typedef cxx::Bitfield<decltype(data_member), LSB, MSB> name ## _bfm_t; \ 
  284  constexpr typename name ## _bfm_t::Val name() const { return data_member; } \ 
  285  typename name ## _bfm_t::Val name() const volatile { return data_member; } \ 
  288#define CXX_BITFIELD_MEMBER_UNSHIFTED(LSB, MSB, name, data_member) \ 
  291  typedef cxx::Bitfield<decltype(data_member), LSB, MSB> name ## _bfm_t; \ 
  293  constexpr typename name ## _bfm_t::Val_unshifted name() const { return data_member; } \ 
  294  typename name ## _bfm_t::Val_unshifted name() const volatile { return data_member; } \ 
  296  constexpr typename name ## _bfm_t::Ref_unshifted name() { return data_member; } \ 
  297  typename name ## _bfm_t::Ref_unshifted_volatile name() volatile { return data_member; } \ 
  300#define CXX_BITFIELD_MEMBER_UNSHIFTED_RO(LSB, MSB, name, data_member) \ 
  303  typedef cxx::Bitfield<decltype(data_member), LSB, MSB> name ## _bfm_t; \ 
  305  constexpr typename name ## _bfm_t::Val_unshifted name() const { return data_member; } \ 
  306  typename name ## _bfm_t::Val_unshifted name() const volatile { return data_member; } \ 
Definition for a member (part) of a bit field.
 
static constexpr Bits_type get(Shift_type val)
Get the bits out of val.
 
Value_unshifted< Base_type volatile & > Ref_unshifted_volatile
 
static constexpr Base_type val_unshifted(Shift_type val)
Get the shifted bits for val.
 
Value< Base_type volatile & > Ref_volatile
 
Masks
Masks for bitswise operation on internal parts of a bitfield.
 
static Base_type set(Base_type dest, Bits_type val)
Set the bits corresponding to val.
 
Best_type< Bits+Lsb >::Type Shift_type
 
Value< Base_type const > Val
 
static constexpr Base_type val_dirty(Shift_type val)
Get the shifted bits for val.
 
static constexpr Base_type set_unshifted_dirty(Base_type dest, Shift_type val)
Set the bits corresponding to val.
 
static constexpr Base_type val(Bits_type val)
 
Best_type< Bits >::Type Bits_type
 
static Base_type set_unshifted(Base_type dest, Shift_type val)
Set the bits corresponding to val.
 
Value_unshifted< Base_type & > Ref_unshifted
 
static constexpr Base_type get_unshifted(Shift_type val)
Get the bits in place out of val.
 
static constexpr Base_type set_dirty(Base_type dest, Shift_type val)
Set the bits corresponding to val.
 
Value_unshifted< Base_type const > Val_unshifted