Remove some unnecessary operators from ox::LittleEndian

This commit is contained in:
Gary Talent 2018-03-09 21:48:16 -06:00
parent 56ed98268f
commit 086b406748

View File

@ -79,7 +79,7 @@ inline T bigEndianAdapt(T i) {
template<typename T> template<typename T>
class __attribute__((packed)) LittleEndian { class LittleEndian {
private: private:
T m_value; T m_value;
@ -99,7 +99,8 @@ class __attribute__((packed)) LittleEndian {
return *this; return *this;
} }
inline T operator=(T value) { template<typename I>
inline T operator=(I value) {
m_value = ox::bigEndianAdapt(value); m_value = ox::bigEndianAdapt(value);
return value; return value;
} }
@ -137,7 +138,7 @@ class __attribute__((packed)) LittleEndian {
} }
// Prefix increment // Prefix increment
inline T &operator++() { inline T operator++() {
return operator+=(1); return operator+=(1);
} }
@ -149,7 +150,7 @@ class __attribute__((packed)) LittleEndian {
} }
// Prefix decrement // Prefix decrement
inline T &operator--() { inline T operator--() {
return operator-=(1); return operator-=(1);
} }
@ -160,55 +161,36 @@ class __attribute__((packed)) LittleEndian {
return old; return old;
} }
inline T operator~() const { template<typename I>
return ~ox::bigEndianAdapt(m_value); inline T operator&=(I other) {
}
inline T operator&(T value) const {
return ox::bigEndianAdapt(m_value) & value;
}
inline T operator&=(T other) {
auto newVal = *this & other; auto newVal = *this & other;
m_value = ox::bigEndianAdapt(newVal); m_value = ox::bigEndianAdapt(newVal);
return newVal; return newVal;
} }
inline T operator|(T value) const { template<typename I>
return ox::bigEndianAdapt(m_value) | value; inline T operator|=(I other) {
}
inline T operator|=(T other) {
auto newVal = *this | other; auto newVal = *this | other;
m_value = ox::bigEndianAdapt(newVal); m_value = ox::bigEndianAdapt(newVal);
return newVal; return newVal;
} }
inline T operator^(T value) const { template<typename I>
return ox::bigEndianAdapt(m_value) ^ value; inline T operator^=(I other) {
}
inline T operator^=(T other) {
auto newVal = *this ^ other; auto newVal = *this ^ other;
m_value = ox::bigEndianAdapt(newVal); m_value = ox::bigEndianAdapt(newVal);
return newVal; return newVal;
} }
inline T operator>>(T value) const { template<typename I>
return ox::bigEndianAdapt(m_value) >> value; inline T operator>>=(I other) {
}
inline T operator>>=(T other) {
auto newVal = *this >> other; auto newVal = *this >> other;
m_value = ox::bigEndianAdapt(newVal); m_value = ox::bigEndianAdapt(newVal);
return newVal; return newVal;
} }
inline T operator<<(T value) const { template<typename I>
return ox::bigEndianAdapt(m_value) << value; inline T operator<<=(I other) {
}
inline T operator<<=(T other) {
auto newVal = *this << other; auto newVal = *this << other;
m_value = ox::bigEndianAdapt(newVal); m_value = ox::bigEndianAdapt(newVal);
return newVal; return newVal;