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>
37
37
class TBitField {
38
38
public:
39
39
// / @brief The default class constructor.
40
- TBitField ();
40
+ TBitField () = default ;
41
41
42
42
// / @brief The class constructor with the initial value.
43
43
// / @param[in] init The init value.
@@ -48,12 +48,12 @@ class TBitField {
48
48
49
49
// / @brief Returns the current bit-mask.
50
50
// / @return The bitmask.
51
- T GetMask () const ;
51
+ T getMask () const ;
52
52
53
53
// / @brief Will return the bit at the given position.
54
54
// / @param[in] pos The bit position for readout.
55
55
// / @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 ;
57
57
58
58
// / @brief Will set the bit at the given position to the given state.
59
59
// / @param[in] pos The bit position for write.
@@ -76,28 +76,21 @@ class TBitField {
76
76
size_t maxBits () const ;
77
77
78
78
private:
79
- T mBitMask ;
79
+ T mBitMask { 0 } ;
80
80
};
81
81
82
82
template <class T >
83
- inline TBitField<T>::TBitField() :
84
- mBitMask (0 ) {
83
+ inline TBitField<T>::TBitField(T init) : mBitMask (init) {
85
84
// empty
86
85
}
87
86
88
87
template <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 {
96
89
return mBitMask ;
97
90
}
98
91
99
92
template <class T >
100
- inline bool TBitField<T>::getBit(size_t pos) const {
93
+ inline bool constexpr TBitField<T>::getBit(size_t pos) const noexcept {
101
94
assert (pos < maxBits ());
102
95
return (mBitMask & (1 << pos)) != 0 ;
103
96
}
You can’t perform that action at this time.
0 commit comments