diff --git a/libc/include/__/endian.h b/libc/include/__/endian.h index 88adf62f..2c94318d 100644 --- a/libc/include/__/endian.h +++ b/libc/include/__/endian.h @@ -128,7 +128,12 @@ public: __endian_base() { } __endian_base(const T& t) : representation(swap(t)) { } operator T() const { return swap(representation); } - operator T() const volatile { return swap((const T) representation); } + operator T() const volatile + { + T value = representation; + __endian_base wrapper(value); + return wrapper.representation; + } __endian_base& operator=(const T& rhs) {