diff --git a/lib/bufferstream/bufferstream.h b/lib/bufferstream/bufferstream.h index 958af43..62b799d 100644 --- a/lib/bufferstream/bufferstream.h +++ b/lib/bufferstream/bufferstream.h @@ -125,16 +125,12 @@ public: else { auto bytes = reinterpret_cast(&ret); - switch (order_) { - case LittleEndian: + if (order_ == endian::native) for (int_fast8_t i = 0; i < width; i++) bytes[i] = get(); - break; - case BigEndian: - for (int_fast8_t i = width; --i >= 0;) + else + for (int_fast8_t i = width; --i >= 0;) bytes[i] = get(); - break; - } } if (!in_avail()) setstate(std::ios_base::eofbit); @@ -153,16 +149,12 @@ public: return; } auto bytes = reinterpret_cast(&val); - switch (order_) { - case LittleEndian: + if (order_ == endian::native) for (int_fast8_t i = 0; i < width; i++) put(bytes[i]); - break; - case BigEndian: + else for (int_fast8_t i = width; --i >= 0;) put(bytes[i]); - break; - } } private: