strict-aliasing........

This commit is contained in:
tildearrow 2023-01-15 00:45:31 -05:00
parent be79f80770
commit cb11d3f268

View file

@ -136,7 +136,9 @@ float SafeReader::readF() {
memcpy(&ret,&buf[curSeek],4); memcpy(&ret,&buf[curSeek],4);
curSeek+=4; curSeek+=4;
ret=((ret>>24)|((ret&0xff0000)>>8)|((ret&0xff00)<<8)|((ret&0xff)<<24)); ret=((ret>>24)|((ret&0xff0000)>>8)|((ret&0xff00)<<8)|((ret&0xff)<<24));
return *((float*)(&ret)); float realRet;
memcpy(&realRet,&ret,4);
return realRet;
} }
double SafeReader::readD() { double SafeReader::readD() {
@ -153,7 +155,9 @@ double SafeReader::readD() {
retB[5]=ret[2]; retB[5]=ret[2];
retB[6]=ret[1]; retB[6]=ret[1];
retB[7]=ret[0]; retB[7]=ret[0];
return *((double*)retB); double realRet;
memcpy(&realRet,retB,8);
return realRet;
} }
#else #else
short SafeReader::readS() { short SafeReader::readS() {