diff --git a/nall/primitives/bit-range.hpp b/nall/primitives/bit-range.hpp index 1efc21cc..7d8112e2 100644 --- a/nall/primitives/bit-range.hpp +++ b/nall/primitives/bit-range.hpp @@ -58,7 +58,8 @@ template struct BitRange { } template inline auto& operator=(const T& source) { - target = target & ~mask | source << shift & mask; + type value = source; + target = target & ~mask | value << shift & mask; return *this; } @@ -105,17 +106,20 @@ template struct BitRange { } template inline auto& operator&=(const T& source) { - target = target & (~mask | source << shift & mask); + type value = source; + target = target & (~mask | value << shift & mask); return *this; } template inline auto& operator^=(const T& source) { - target = target ^ source << shift & mask; + type value = source; + target = target ^ value << shift & mask; return *this; } template inline auto& operator|=(const T& source) { - target = target | source << shift & mask; + type value = source; + target = target | value << shift & mask; return *this; } @@ -185,7 +189,8 @@ template struct BitRange { } template inline auto& operator=(const T& source) { - target = target & ~mask | source << shift & mask; + type value = source; + target = target & ~mask | value << shift & mask; return *this; } @@ -232,17 +237,20 @@ template struct BitRange { } template inline auto& operator&=(const T& source) { - target = target & (~mask | source << shift & mask); + type value = source; + target = target & (~mask | value << shift & mask); return *this; } template inline auto& operator^=(const T& source) { - target = target ^ source << shift & mask; + type value = source; + target = target ^ value << shift & mask; return *this; } template inline auto& operator|=(const T& source) { - target = target | source << shift & mask; + type value = source; + target = target | value << shift & mask; return *this; }