Skip to content

Commit

Permalink
Readability
Browse files Browse the repository at this point in the history
  • Loading branch information
greymistcube committed Jul 12, 2023
1 parent 2f8b039 commit 24a9e46
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Bencodex/Encoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,11 @@ internal static long CountDecimalDigits(long value)

internal static long EncodeDigits(long positiveInt, byte[] buffer, long offset)
{
const int asciiZero = 0x30; // '0'
long length = CountDecimalDigits(positiveInt);
for (long i = offset + length - 1; i >= offset; i--)
{
buffer[i] = (byte)(positiveInt % 10 + 48);
buffer[i] = (byte)(positiveInt % 10 + asciiZero);
positiveInt /= 10;
}

Expand Down

0 comments on commit 24a9e46

Please sign in to comment.