From cd38c961a31d1636675c4f4547ee135231a64df8 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 19 Feb 2018 21:05:00 -0600 Subject: [PATCH] Add missing operators to LittleEndian type --- deps/ox/src/ox/std/byteswap.hpp | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/deps/ox/src/ox/std/byteswap.hpp b/deps/ox/src/ox/std/byteswap.hpp index 520443bb..6c595fff 100644 --- a/deps/ox/src/ox/std/byteswap.hpp +++ b/deps/ox/src/ox/std/byteswap.hpp @@ -171,6 +171,60 @@ class LittleEndian { return old; } + inline T operator~() { + return ~ox::bigEndianAdapt(m_value); + } + + inline T operator&(T value) { + return ox::bigEndianAdapt(m_value) & value; + } + + inline T operator&=(T other) { + auto newVal = *this & other; + m_value = ox::bigEndianAdapt(newVal); + return newVal; + } + + inline T operator|(T value) { + return ox::bigEndianAdapt(m_value) | value; + } + + inline T operator|=(T other) { + auto newVal = *this | other; + m_value = ox::bigEndianAdapt(newVal); + return newVal; + } + + inline T operator^(T value) { + return ox::bigEndianAdapt(m_value) ^ value; + } + + inline T operator^=(T other) { + auto newVal = *this ^ other; + m_value = ox::bigEndianAdapt(newVal); + return newVal; + } + + inline T operator>>(T value) { + return ox::bigEndianAdapt(m_value) >> value; + } + + inline T operator>>=(T other) { + auto newVal = *this >> other; + m_value = ox::bigEndianAdapt(newVal); + return newVal; + } + + inline T operator<<(T value) { + return ox::bigEndianAdapt(m_value) << value; + } + + inline T operator<<=(T other) { + auto newVal = *this << other; + m_value = ox::bigEndianAdapt(newVal); + return newVal; + } + }; }