Skip to content

Commit

Permalink
Review comments, gfoidl dotnet#1
Browse files Browse the repository at this point in the history
- change local variables from ushort to int
  • Loading branch information
rokonec committed Nov 10, 2020
1 parent 828c1d6 commit 224f1bc
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,9 @@ public static int Decode(ReadOnlySpan<byte> src, ref byte[] dstArray)
int lookupTableIndex = 0;
int lookupIndex;

ushort acc = 0;
uint acc = 0;
int bitsInAcc = 0;


int i = 0;
int j = 0;
while (i < src.Length)
Expand All @@ -440,7 +439,7 @@ public static int Decode(ReadOnlySpan<byte> src, ref byte[] dstArray)
{
lookupIndex = (byte)(acc >> (bitsInAcc - 8));

ushort lookupValue = decodingTree[(lookupTableIndex << 8) + lookupIndex];
int lookupValue = decodingTree[(lookupTableIndex << 8) + lookupIndex];

if (lookupValue < 0x80_00)
{
Expand Down Expand Up @@ -499,7 +498,7 @@ public static int Decode(ReadOnlySpan<byte> src, ref byte[] dstArray)
// Lookup index has to be 8 bits aligned to MSB
lookupIndex = (byte)(acc << (8 - bitsInAcc));

ushort lookupValue = decodingTree[(lookupTableIndex << 8) + lookupIndex];
int lookupValue = decodingTree[(lookupTableIndex << 8) + lookupIndex];

if (lookupValue < 0x80_00)
{
Expand Down

0 comments on commit 224f1bc

Please sign in to comment.