Skip to content

Commit

Permalink
Use consistent casing in the bit collections' ToString representation.
Browse files Browse the repository at this point in the history
And optimize the string builder by creating it with an initial capacity.
  • Loading branch information
teo-tsirpanis committed Jan 26, 2021
1 parent 33c585a commit 31d45ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BitCollections/BitAlgorithms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ internal static void Not(Span<ulong> x)

internal static string FormatBitArray(ulong first, ReadOnlySpan<ulong> rest)
{
var sb = new StringBuilder();
var sb = new StringBuilder(17 * rest.Length + 16);
for (int i = rest.Length - 1; i >= 0; i--)
{
sb.Append(rest[i].ToString("x16")).Append('-');
sb.Append(rest[i].ToString("X16")).Append('-');
}
sb.Append(first.ToString("X16"));
return sb.ToString();
Expand Down

0 comments on commit 31d45ff

Please sign in to comment.