mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 00:38:48 +00:00
fix: fix incorrect endian swap
This commit is contained in:
parent
ed46bcd0d8
commit
caa0070458
@ -48,11 +48,11 @@ public static class DoubleExtensions
|
||||
#else
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return MemoryMarshal.TryWrite(destination, ref value);
|
||||
long tmp = BinaryPrimitives.ReverseEndianness(BitConverter.DoubleToInt64Bits(value));
|
||||
return MemoryMarshal.TryWrite(destination, ref tmp);
|
||||
}
|
||||
|
||||
long tmp = BinaryPrimitives.ReverseEndianness(BitConverter.DoubleToInt64Bits(value));
|
||||
return MemoryMarshal.TryWrite(destination, ref tmp);
|
||||
return MemoryMarshal.TryWrite(destination, ref value);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public static class DoubleExtensions
|
||||
#if NET5_0_OR_GREATER
|
||||
return BinaryPrimitives.TryWriteDoubleLittleEndian(destination, value);
|
||||
#else
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return MemoryMarshal.TryWrite(destination, ref value);
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ public static class SingleExtensions
|
||||
#else
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return MemoryMarshal.TryWrite(destination, ref value);
|
||||
int tmp = BinaryPrimitives.ReverseEndianness(BitConverter.SingleToInt32Bits(value));
|
||||
return MemoryMarshal.TryWrite(destination, ref tmp);
|
||||
}
|
||||
|
||||
int tmp = BinaryPrimitives.ReverseEndianness(BitConverter.SingleToInt32Bits(value));
|
||||
return MemoryMarshal.TryWrite(destination, ref tmp);
|
||||
return MemoryMarshal.TryWrite(destination, ref value);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ public static class SingleExtensions
|
||||
#if NET5_0_OR_GREATER
|
||||
return BinaryPrimitives.TryWriteSingleLittleEndian(destination, value);
|
||||
#else
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return MemoryMarshal.TryWrite(destination, ref value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user