@@ -64,15 +64,15 @@ struct reg_t
6464 }
6565
6666 template <typename U>
67- inline constexpr auto operator =(const U& bit_field_value) const noexcept -> decltype (std::declval<U>().value, std::declval<U>().mask, std::declval<reg_t<T,address>>())
67+ inline constexpr auto operator =(const U& bit_field_value) const noexcept -> std:: remove_reference_t < decltype (std::declval<U>().value, std::declval<U>().mask, std::declval<reg_t <T,address>>())>
6868 {
6969 static_assert (!readonly," this register is read-only" );
7070 reg_t::value () = bit_field_value.value ;
7171 return reg_t <T,address>{};
7272 }
7373
7474 template <typename U>
75- inline constexpr auto operator |=(const U& bit_field_value) const noexcept -> decltype (std::declval<U>().value, std::declval<U>().mask, std::declval<reg_t<T,address>>())
75+ inline constexpr auto operator |=(const U& bit_field_value) const noexcept -> std:: remove_reference_t < decltype (std::declval<U>().value, std::declval<U>().mask, std::declval<reg_t <T,address>>())>
7676 {
7777 static_assert (!readonly," this register is read-only" );
7878 reg_t::value () = (reg_t::value () & ~bit_field_value.mask ) | bit_field_value.value ;
@@ -186,14 +186,14 @@ struct bitfield_array_t
186186 reg_t::value () = mask & (value << start_index);
187187 else if constexpr (std::conjunction_v<std::is_enum<T>, std::is_same<T,value_t >>)
188188 {
189- auto v = bitfield_cat<count-1 >(static_cast <unsigned long long >(value), width);
189+ auto v = bitfield_cat<count-1 >(static_cast <typename reg_t ::type >(value), width);
190190 reg_t::value () = mask & (v << start_index);
191191 }
192192 return bitfield_array_t <start_index,width,reg_t ,count,value_t >{};
193193 }
194194
195- constexpr operator typename reg_t::type () noexcept { return typename reg_t::type (( int ( reg_t::value ())& mask)>>start_index) ; }
196- constexpr operator typename reg_t::type () const noexcept { return typename reg_t::type (( int ( reg_t::value ())& mask)>>start_index) ; }
195+ constexpr operator typename reg_t::type () noexcept { return ( typename reg_t::type (reg_t::value ())& mask)>>start_index; }
196+ constexpr operator typename reg_t::type () const noexcept { return ( typename reg_t::type (reg_t::value ())& mask)>>start_index; }
197197};
198198
199199}
0 commit comments