diff --git a/SabreTools.IO.Test/Streams/ReadOnlyBitStreamTests.cs b/SabreTools.IO.Test/Streams/ReadOnlyBitStreamTests.cs index 39cb347..677a632 100644 --- a/SabreTools.IO.Test/Streams/ReadOnlyBitStreamTests.cs +++ b/SabreTools.IO.Test/Streams/ReadOnlyBitStreamTests.cs @@ -19,44 +19,44 @@ namespace SabreTools.IO.Test.Streams } [Fact] - public void ReadSingleBitLSBTest() + public void ReadSingleBitLETest() { byte[] data = [0b01010101]; var stream = new ReadOnlyBitStream(new MemoryStream(data)); - byte? bit = stream.ReadBitLSB(); + byte? bit = stream.ReadBitLE(); Assert.NotNull(bit); Assert.Equal((byte)0b00000000, bit); Assert.Equal(1, stream.Position); } [Fact] - public void ReadSingleBitMSBTest() + public void ReadSingleBitBETest() { byte[] data = [0b01010101]; var stream = new ReadOnlyBitStream(new MemoryStream(data)); - byte? bit = stream.ReadBitMSB(); + byte? bit = stream.ReadBitBE(); Assert.NotNull(bit); Assert.Equal((byte)0b00000001, bit); Assert.Equal(1, stream.Position); } [Fact] - public void ReadBitsLSBTest() + public void ReadBitsLETest() { byte[] data = [0b01010101, 0b01010101, 0b01010101, 0b01010101]; var stream = new ReadOnlyBitStream(new MemoryStream(data)); - uint? bits = stream.ReadBitsLSB(4); + uint? bits = stream.ReadBitsLE(4); Assert.NotNull(bits); Assert.Equal((byte)0b00001010, bits); // Transcribed to big-endian Assert.Equal(1, stream.Position); } [Fact] - public void ReadBitsMSBTest() + public void ReadBitsBETest() { byte[] data = [0b01010101, 0b01010101, 0b01010101, 0b01010101]; var stream = new ReadOnlyBitStream(new MemoryStream(data)); - uint? bits = stream.ReadBitsMSB(4); + uint? bits = stream.ReadBitsBE(4); Assert.NotNull(bits); Assert.Equal((byte)0b00001010, bits); Assert.Equal(1, stream.Position); diff --git a/SabreTools.IO/Streams/ReadOnlyBitStream.cs b/SabreTools.IO/Streams/ReadOnlyBitStream.cs index af680ab..980a3f3 100644 --- a/SabreTools.IO/Streams/ReadOnlyBitStream.cs +++ b/SabreTools.IO/Streams/ReadOnlyBitStream.cs @@ -57,7 +57,7 @@ namespace SabreTools.IO.Streams /// Read a single bit little-endian, if possible /// /// The next bit encoded in a byte, null on error or end of stream - public byte? ReadBitLSB() + public byte? ReadBitLE() { // If we reached the end of the stream if (_source.Position >= _source.Length) @@ -91,7 +91,7 @@ namespace SabreTools.IO.Streams /// Read a single bit big-endian, if possible /// /// The next bit encoded in a byte, null on error or end of stream - public byte? ReadBitMSB() + public byte? ReadBitBE() { // If we reached the end of the stream if (_source.Position >= _source.Length) @@ -122,16 +122,16 @@ namespace SabreTools.IO.Streams } /// - /// Read a multiple bits in LSB, if possible + /// Read a multiple bits in little-endian, if possible /// /// The next bits encoded in a UInt32, null on error or end of stream - public uint? ReadBitsLSB(int bits) + public uint? ReadBitsLE(int bits) { uint value = 0; for (int i = 0; i < bits; i++) { // Read the next bit - byte? bitValue = ReadBitLSB(); + byte? bitValue = ReadBitLE(); if (bitValue == null) return null; @@ -143,16 +143,16 @@ namespace SabreTools.IO.Streams } /// - /// Read a multiple bits in MSB, if possible + /// Read a multiple bits in big-endian, if possible /// /// The next bits encoded in a UInt32, null on error or end of stream - public uint? ReadBitsMSB(int bits) + public uint? ReadBitsBE(int bits) { uint value = 0; for (int i = 0; i < bits; i++) { // Read the next bit - byte? bitValue = ReadBitMSB(); + byte? bitValue = ReadBitBE(); if (bitValue == null) return null;