sources/network/bytestream.cpp

changeset 61
cdf3c8af1545
parent 58
d175243ad169
child 73
07dda51a7a8e
--- a/sources/network/bytestream.cpp	Tue Dec 16 03:30:15 2014 +0200
+++ b/sources/network/bytestream.cpp	Tue Dec 16 03:44:05 2014 +0200
@@ -178,8 +178,10 @@
 METHOD
 Bytestream::read_float() -> float
 {
-	int value = read_long();
-	return reinterpret_cast<float&> (value);
+	float value;
+	int intvalue = read_long();
+	memcpy (&value, &intvalue, sizeof intvalue);
+	return value;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -292,7 +294,9 @@
 Bytestream::write_float (float val) -> void
 {
 	// I know this is probably dangerous but this is what Zandronum does so yeah
-	write_long (reinterpret_cast<int&> (val));
+	int intvalue;
+	memcpy (&intvalue, &val, sizeof val);
+	write_long (intvalue);
 }
 
 // -------------------------------------------------------------------------------------------------

mercurial