Change Double BigEndian swap code
The old one was optimized away
This generates worse code but as this is only used during Load and Save the negative speed impact can be ignored
MODIFY
src/reader_lcf.cpp
src/reader_lcf.cpp
@@ -320,12 +320,11 @@ void LcfReader::SwapByteOrder(uint32_t& ui)
void LcfReader::SwapByteOrder(double& d)
{
- uint32_t *p = reinterpret_cast<uint32_t *>(&d);
- SwapByteOrder(p[0]);
- SwapByteOrder(p[1]);
- uint32_t tmp = p[0];
- p[0] = p[1];
- p[1] = tmp;
+ char *p = reinterpret_cast<char*>(&d);
+ std::swap(p[0], p[7]);
+ std::swap(p[1], p[6]);
+ std::swap(p[2], p[5]);
+ std::swap(p[3], p[4]);
}
#else
void LcfReader::SwapByteOrder(uint16_t& /* us */) {}

MODIFY
src/writer_lcf.cpp
src/writer_lcf.cpp
@@ -161,12 +161,11 @@ void LcfWriter::SwapByteOrder(uint32_t& ui)
void LcfWriter::SwapByteOrder(double& d)
{
- uint32_t *p = reinterpret_cast<uint32_t *>(&d);
- SwapByteOrder(p[0]);
- SwapByteOrder(p[1]);
- uint32_t tmp = p[0];
- p[0] = p[1];
- p[1] = tmp;
+ char *p = reinterpret_cast<char*>(&d);
+ std::swap(p[0], p[7]);
+ std::swap(p[1], p[6]);
+ std::swap(p[2], p[5]);
+ std::swap(p[3], p[4]);
}
#else
void LcfWriter::SwapByteOrder(uint16_t& /* us */) {}

Change Double BigEndian swap code

The old one was optimized away
This generates worse code but as this is only used during Load and Save the negative speed impact can be ignored