diff options
| author | Bond_009 <bond.009@outlook.com> | 2020-05-02 00:54:04 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2020-05-02 00:54:04 +0200 |
| commit | 15634a1913e8c1ad4e921364f30055794644d0bd (patch) | |
| tree | f0dfb3502728e4786de32c0cb4eaabd06f8e2d87 /DvdLib/BigEndianBinaryReader.cs | |
| parent | 407f54e7764a6bfd8e4ccc0df897fac7e8c658b4 (diff) | |
| parent | 62e251663fce8216cea529f85382299ac2f39fbc (diff) | |
Merge branch 'master' into websocket
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)); } } } |
