From 989b06d04cacef84bdfacafc00161fd36deae47c Mon Sep 17 00:00:00 2001 From: js6pak Date: Fri, 2 Apr 2021 23:45:01 +0200 Subject: [PATCH] Use BitConverter.Int32BitsToSingle in SpanReaderExtensions --- src/Impostor.Api/Extensions/SpanReaderExtensions.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Impostor.Api/Extensions/SpanReaderExtensions.cs b/src/Impostor.Api/Extensions/SpanReaderExtensions.cs index 78e5a45..05b891a 100644 --- a/src/Impostor.Api/Extensions/SpanReaderExtensions.cs +++ b/src/Impostor.Api/Extensions/SpanReaderExtensions.cs @@ -35,9 +35,7 @@ namespace Impostor.Api { var original = Advance(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); - } - /// /// Advances the position of by the size of . /// -- 2.39.5