File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ template <class T>
3737class TBitField {
3838public:
3939 // / @brief The default class constructor.
40- TBitField ();
40+ TBitField () = default ;
4141
4242 // / @brief The class constructor with the initial value.
4343 // / @param[in] init The init value.
@@ -48,12 +48,12 @@ class TBitField {
4848
4949 // / @brief Returns the current bit-mask.
5050 // / @return The bitmask.
51- T GetMask () const ;
51+ T getMask () const ;
5252
5353 // / @brief Will return the bit at the given position.
5454 // / @param[in] pos The bit position for readout.
5555 // / @return true for bit is set, false for not.
56- bool getBit (size_t pos) const ;
56+ bool constexpr getBit (size_t pos) const noexcept ;
5757
5858 // / @brief Will set the bit at the given position to the given state.
5959 // / @param[in] pos The bit position for write.
@@ -76,28 +76,21 @@ class TBitField {
7676 size_t maxBits () const ;
7777
7878private:
79- T mBitMask ;
79+ T mBitMask { 0 } ;
8080};
8181
8282template <class T >
83- inline TBitField<T>::TBitField() :
84- mBitMask (0 ) {
83+ inline TBitField<T>::TBitField(T init) : mBitMask (init) {
8584 // empty
8685}
8786
8887template <class T >
89- inline TBitField<T>::TBitField(T init) :
90- mBitMask (init) {
91- // empty
92- }
93-
94- template <class T >
95- inline T TBitField<T>::GetMask() const {
88+ inline T TBitField<T>::getMask() const {
9689 return mBitMask ;
9790}
9891
9992template <class T >
100- inline bool TBitField<T>::getBit(size_t pos) const {
93+ inline bool constexpr TBitField<T>::getBit(size_t pos) const noexcept {
10194 assert (pos < maxBits ());
10295 return (mBitMask & (1 << pos)) != 0 ;
10396}
You can’t perform that action at this time.
0 commit comments