aboutsummaryrefslogtreecommitdiff
path: root/DvdLib/BigEndianBinaryReader.cs
diff options
context:
space:
mode:
authorPika <15848969+ThatNerdyPikachu@users.noreply.github.com>2020-07-23 18:59:25 -0400
committerGitHub <noreply@github.com>2020-07-23 18:59:25 -0400
commit3b21abd879c278bdc7d2f02a62eba3a57cb55987 (patch)
treef045e94b60f1f8d6eb63bfda957209e110b1d82c /DvdLib/BigEndianBinaryReader.cs
parent7aba10eff67151a9f6593e9d3d702f17029b994f (diff)
parent845ee21ddce8ed91d8c3c1463d0d7a06bb769635 (diff)
Merge branch 'master' into more-track-titles
Diffstat (limited to 'DvdLib/BigEndianBinaryReader.cs')
-rw-r--r--DvdLib/BigEndianBinaryReader.cs15
1 files changed, 5 insertions, 10 deletions
diff --git a/DvdLib/BigEndianBinaryReader.cs b/DvdLib/BigEndianBinaryReader.cs
index b3b2eabd5..b3aad85ce 100644
--- a/DvdLib/BigEndianBinaryReader.cs
+++ b/DvdLib/BigEndianBinaryReader.cs
@@ -1,4 +1,6 @@
-using System;
+#pragma warning disable CS1591
+
+using System.Buffers.Binary;
using System.IO;
namespace DvdLib
@@ -12,19 +14,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));
}
}
}