diff --git a/X10D/src/IO/DoubleExtensions.cs b/X10D/src/IO/DoubleExtensions.cs index ec9fc7d..a981d23 100644 --- a/X10D/src/IO/DoubleExtensions.cs +++ b/X10D/src/IO/DoubleExtensions.cs @@ -58,7 +58,8 @@ public static class DoubleExtensions { if (BitConverter.IsLittleEndian == (endianness == Endianness.BigEndian)) { - value = BinaryPrimitives.ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); + long tmp = BinaryPrimitives.ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); + value = BitConverter.Int64BitsToDouble(tmp); } return MemoryMarshal.TryWrite(destination, ref value); diff --git a/X10D/src/IO/SingleExtensions.cs b/X10D/src/IO/SingleExtensions.cs index f2bf3d9..5db19f5 100644 --- a/X10D/src/IO/SingleExtensions.cs +++ b/X10D/src/IO/SingleExtensions.cs @@ -58,7 +58,8 @@ public static class SingleExtensions { if (BitConverter.IsLittleEndian == (endianness == Endianness.BigEndian)) { - value = BinaryPrimitives.ReverseEndianness(BitConverter.SingleToInt32Bits(value)); + int tmp = BinaryPrimitives.ReverseEndianness(BitConverter.SingleToInt32Bits(value)); + value = BitConverter.Int32BitsToSingle(tmp); } return MemoryMarshal.TryWrite(destination, ref value); diff --git a/X10D/src/IO/StreamExtensions.cs b/X10D/src/IO/StreamExtensions.cs index 4b16c5a..edabeec 100644 --- a/X10D/src/IO/StreamExtensions.cs +++ b/X10D/src/IO/StreamExtensions.cs @@ -173,7 +173,8 @@ public static class StreamExtensions if (BitConverter.IsLittleEndian == (endianness == Endianness.BigEndian)) { - value = BinaryPrimitives.ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); + long tmp = BinaryPrimitives.ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); + value = BitConverter.Int64BitsToDouble(tmp); } return value; @@ -374,7 +375,8 @@ public static class StreamExtensions if (BitConverter.IsLittleEndian == (endianness == Endianness.BigEndian)) { - value = BinaryPrimitives.ReverseEndianness(BitConverter.SingleToInt32Bits(value)); + int tmp = BinaryPrimitives.ReverseEndianness(BitConverter.SingleToInt32Bits(value)); + value = BitConverter.Int32BitsToSingle(tmp); } return value;