FULLPIPE: Use more portable double loading

This commit is contained in:
Eugene Sandulenko 2019-11-10 19:49:19 +01:00
parent 6cad53e546
commit 416ab05eaa
3 changed files with 2 additions and 19 deletions

View File

@ -2871,8 +2871,8 @@ bool MovGraphLink::load(MfcArchive &file) {
debugC(8, kDebugLoading, "GraphNode2");
_graphDst = file.readClass<MovGraphNode>();
_length = file.readDouble();
_angle = file.readDouble();
_length = file.readDoubleLE();
_angle = file.readDoubleLE();
debugC(8, kDebugLoading, "length: %g, angle: %g", _length, _angle);

View File

@ -246,22 +246,6 @@ int MfcArchive::readCount() {
return count;
}
double MfcArchive::readDouble() {
// FIXME: This is utterly cruel and unportable
// Some articles on the matter:
// http://randomascii.wordpress.com/2013/02/07/float-precision-revisited-nine-digit-float-portability/
// http://randomascii.wordpress.com/2012/01/11/tricks-with-the-floating-point-format/
union {
byte b[8];
double d;
} tmp;
read(&tmp.b, 8);
return tmp.d;
}
enum {
kNullObject,
kInteraction,

View File

@ -56,7 +56,6 @@ public:
Common::String readPascalString(bool twoByte = false);
void writePascalString(const Common::String &str, bool twoByte = false);
int readCount();
double readDouble();
CObject *parseClass(bool *isCopyReturned);
/** ownership of returned object is passed to caller */