mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
Use BitConverter.Int32BitsToSingle in SpanReaderExtensions
This commit is contained in:
1 parent
11e87e51db
commit
989b06d04c
1 file changed
+1
-9
@@ -35,9 +35,7 @@ namespace Impostor.Api
|
||||
{
|
||||
var original = Advance<float>(ref input);
|
||||
|
||||
// BitConverter.Int32BitsToSingle
|
||||
// Doesn't exist in net 2.0 for some reason
|
||||
return Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(original));
|
||||
return BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(original));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -46,12 +44,6 @@ namespace Impostor.Api
|
||||
return input.ReadByte() != 0;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static unsafe float Int32BitsToSingle(int value)
|
||||
{
|
||||
return *((float*)&value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the position of <paramref name="input" /> by the size of <typeparamref name="T" />.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user