Fix bitstream read naming again

This commit is contained in:
Matt Nadareski
2024-11-25 23:12:05 -05:00
parent 0b7ab5b932
commit a7b50dfdf2
2 changed files with 8 additions and 8 deletions

View File

@@ -34,11 +34,11 @@ namespace SabreTools.IO.Test.Streams
[Theory]
[InlineData(4, 0b00000101, 1)]
[InlineData(9, 0b10101010_1, 2)]
public void ReadBitsLETest(int bits, uint expected, int position)
public void ReadBitsBETest(int bits, uint expected, int position)
{
byte[] data = [0b01010101, 0b01010101, 0b01010101, 0b01010101];
var stream = new ReadOnlyBitStream(new MemoryStream(data));
uint? actual = stream.ReadBitsLE(bits);
uint? actual = stream.ReadBitsBE(bits);
Assert.NotNull(actual);
Assert.Equal(expected, actual);
@@ -48,11 +48,11 @@ namespace SabreTools.IO.Test.Streams
[Theory]
[InlineData(4, 0b00001010, 1)]
[InlineData(9, 0b10101010_1, 2)]
public void ReadBitsBETest(int bits, uint expected, int position)
public void ReadBitsLETest(int bits, uint expected, int position)
{
byte[] data = [0b01010101, 0b01010101, 0b01010101, 0b01010101];
var stream = new ReadOnlyBitStream(new MemoryStream(data));
uint? actual = stream.ReadBitsBE(bits);
uint? actual = stream.ReadBitsLE(bits);
Assert.NotNull(actual);
Assert.Equal(expected, actual);

View File

@@ -88,11 +88,11 @@ namespace SabreTools.IO.Streams
}
/// <summary>
/// Read a multiple bits in little-endian, if possible
/// Read a multiple bits MSB-first, if possible
/// </summary>
/// <returns>The next bits encoded in a UInt32, null on error or end of stream</returns>
/// <remarks>[76543210] order within a byte, appended to output [76543210]</remarks>
public uint? ReadBitsLE(int bits)
public uint? ReadBitsBE(int bits)
{
uint value = 0;
for (int i = 0; i < bits; i++)
@@ -110,11 +110,11 @@ namespace SabreTools.IO.Streams
}
/// <summary>
/// Read a multiple bits in big-endian, if possible
/// Read a multiple bits in LSB-first, if possible
/// </summary>
/// <returns>The next bits encoded in a UInt32, null on error or end of stream</returns>
/// <remarks>[76543210] order within a byte, appended to output [01234567]</remarks>
public uint? ReadBitsBE(int bits)
public uint? ReadBitsLE(int bits)
{
uint value = 0;
for (int i = 0; i < bits; i++)