diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-04-22 13:16:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-22 13:16:08 +0200 |
| commit | 07326c1d9b1a74b6802cd4187104c4272d59e28e (patch) | |
| tree | 1061f46729d67671eeb9b6bd71320732e83ccef9 /DvdLib/BigEndianBinaryReader.cs | |
| parent | daed41815f23795aad7f54965a8ef7eae44a1e08 (diff) | |
| parent | a85b1dcba663fe3bbb2441380cd8da382c92f2bd (diff) | |
Merge branch 'master' into fix-auth-response-codes
Diffstat (limited to 'DvdLib/BigEndianBinaryReader.cs')
| -rw-r--r-- | DvdLib/BigEndianBinaryReader.cs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/DvdLib/BigEndianBinaryReader.cs b/DvdLib/BigEndianBinaryReader.cs index b3b2eabd5..473005b55 100644 --- a/DvdLib/BigEndianBinaryReader.cs +++ b/DvdLib/BigEndianBinaryReader.cs @@ -1,4 +1,4 @@ -using System; +using System.Buffers.Binary; using System.IO; namespace DvdLib @@ -12,19 +12,12 @@ namespace DvdLib public override ushort ReadUInt16() { - return BitConverter.ToUInt16(ReadAndReverseBytes(2), 0); + return BinaryPrimitives.ReadUInt16BigEndian(base.ReadBytes(2)); } public override uint ReadUInt32() { - return BitConverter.ToUInt32(ReadAndReverseBytes(4), 0); - } - - private byte[] ReadAndReverseBytes(int count) - { - byte[] val = base.ReadBytes(count); - Array.Reverse(val, 0, count); - return val; + return BinaryPrimitives.ReadUInt32BigEndian(base.ReadBytes(4)); } } } |
