Skip to content

Commit

Permalink
Non-functional nits
Browse files Browse the repository at this point in the history
  • Loading branch information
steveharter committed Jun 17, 2020
1 parent 0046479 commit 5b4d8b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed class IListConverter<TCollection>
: IEnumerableDefaultConverter<TCollection, object?>
where TCollection : IList
{
protected override void Add(in object? value, ref ReadStack state)
protected override void Add(in object? value, ref ReadStack state)
{
((IList)state.Current.ReturnValue!).Add(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public static ulong GetKey(ReadOnlySpan<byte> propertyName)
{
key = MemoryMarshal.Read<ulong>(propertyName)
& 0x00FFFFFFFFFFFFFF
// Include the length with a max of 0xFF so we force comparisons when length >=0xFF.
// Include the length with a max of 0xFF.
| ((ulong)Math.Min(length, 0xFF)) << (7 * BitsInByte);
}
else if (length > 3)
Expand Down Expand Up @@ -501,17 +501,17 @@ public static ulong GetKey(ReadOnlySpan<byte> propertyName)

// Verify key contains the embedded bytes as expected.
Debug.Assert(
// Verify embedded characters.
(length < 1 || propertyName[0] == ((key & ((ulong)0xFF << 8 * 0)) >> 8 * 0)) &&
(length < 2 || propertyName[1] == ((key & ((ulong)0xFF << 8 * 1)) >> 8 * 1)) &&
(length < 3 || propertyName[2] == ((key & ((ulong)0xFF << 8 * 2)) >> 8 * 2)) &&
(length < 4 || propertyName[3] == ((key & ((ulong)0xFF << 8 * 3)) >> 8 * 3)) &&
(length < 5 || propertyName[4] == ((key & ((ulong)0xFF << 8 * 4)) >> 8 * 4)) &&
(length < 6 || propertyName[5] == ((key & ((ulong)0xFF << 8 * 5)) >> 8 * 5)) &&
(length < 7 || propertyName[6] == ((key & ((ulong)0xFF << 8 * 6)) >> 8 * 6)) &&
// Verify embedded property name.
(length < 1 || propertyName[0] == ((key & ((ulong)0xFF << BitsInByte * 0)) >> BitsInByte * 0)) &&
(length < 2 || propertyName[1] == ((key & ((ulong)0xFF << BitsInByte * 1)) >> BitsInByte * 1)) &&
(length < 3 || propertyName[2] == ((key & ((ulong)0xFF << BitsInByte * 2)) >> BitsInByte * 2)) &&
(length < 4 || propertyName[3] == ((key & ((ulong)0xFF << BitsInByte * 3)) >> BitsInByte * 3)) &&
(length < 5 || propertyName[4] == ((key & ((ulong)0xFF << BitsInByte * 4)) >> BitsInByte * 4)) &&
(length < 6 || propertyName[5] == ((key & ((ulong)0xFF << BitsInByte * 5)) >> BitsInByte * 5)) &&
(length < 7 || propertyName[6] == ((key & ((ulong)0xFF << BitsInByte * 6)) >> BitsInByte * 6)) &&
// Verify embedded length.
((length >= 0xFF || (key & ((ulong)0xFF << 8 * 7)) >> 8 * 7 == (ulong)length)) &&
((length < 0xFF || (key & ((ulong)0xFF << 8 * 7)) >> 8 * 7 == 0xFF)));
(length >= 0xFF || (key & ((ulong)0xFF << BitsInByte * 7)) >> BitsInByte * 7 == (ulong)length) &&
(length < 0xFF || (key & ((ulong)0xFF << BitsInByte * 7)) >> BitsInByte * 7 == 0xFF));

return key;
}
Expand Down

0 comments on commit 5b4d8b0

Please sign in to comment.