diff --git a/include/gp/math/boolean/bitops.hpp b/include/gp/math/boolean/bitops.hpp index ce03019..7b73303 100644 --- a/include/gp/math/boolean/bitops.hpp +++ b/include/gp/math/boolean/bitops.hpp @@ -35,19 +35,25 @@ struct endian_wrapper { gp::array bytes; }; - endian_wrapper() {} + endian_wrapper() noexcept + : value{0} {} - endian_wrapper(T v) + endian_wrapper(T v) noexcept : value{mode == endian::native ? v : swap_endian(v)} {} - endian_wrapper(endian_wrapper& v) + endian_wrapper(const endian_wrapper& v) noexcept : value{v.value} {} - endian_wrapper& operator=(T p) { + endian_wrapper& operator=(T p) noexcept { value = mode == endian::native ? p : swap_endian(p); return *this; } + endian_wrapper& operator=(const endian_wrapper& v) noexcept { + value = v.value; + return *this; + } + operator T() const noexcept { return mode == endian::native ? value : swap_endian(value); }