chore(core): Cleans up networking leftovers from packet conversions (#387)

- [X] Removes span writing extensions
- [X] Removes span reading extensions
- [X] Cleans up OPL and uses uninitialized arrays

Bumps release version
This commit is contained in:
Kamron Batman 2021-01-05 01:31:52 -08:00 • committed by GitHub
parent a278623f38
commit 30ef0761cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 392 deletions

View file

@ -66,6 +66,18 @@ namespace System.Buffers
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public short ReadInt16LE()
{
if (!BinaryPrimitives.TryReadInt16LittleEndian(_buffer.Slice(Position), out var value))
{
throw new OutOfMemoryException();
}
Position += 2;
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ushort ReadUInt16()
{
@ -78,6 +90,18 @@ namespace System.Buffers
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ushort ReadUInt16LE()
{
if (!BinaryPrimitives.TryReadUInt16LittleEndian(_buffer.Slice(Position), out var value))
{
throw new OutOfMemoryException();
}
Position += 2;
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int ReadInt32()
{
@ -102,6 +126,18 @@ namespace System.Buffers
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint ReadUInt32LE()
{
if (!BinaryPrimitives.TryReadUInt32LittleEndian(_buffer.Slice(Position), out var value))
{
throw new OutOfMemoryException();
}
Position += 4;
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ReadString(Encoding encoding, bool safeString = false, int fixedLength = -1)
{