Skip to content

Commit

Permalink
Address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisInSky committed Oct 31, 2024
1 parent df98061 commit 1a50224
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Substrate.Gear.Client.Model.Types.Base;
public static class BaseTypeExtensions
{
/// <summary>
/// Compares two primitive types by their values
/// Compares two primitive types by their values.
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
Expand All @@ -19,9 +19,9 @@ public static bool IsEqualTo<T>(this T left, T right)
EnsureArg.IsNotNull(left, nameof(left));
EnsureArg.IsNotNull(right, nameof(right));
EnsureArg.IsTrue(left.GetType() == right.GetType(), "left/right");
EnsureArg.Is(left.TypeSize, right.TypeSize, "typeSize");

return left.TypeSize == right.TypeSize
&& left.Bytes.Take(left.TypeSize)
.SequenceEqual(right.Bytes.Take(right.TypeSize));
return left.Bytes.AsSpan(0, left.TypeSize)
.SequenceEqual(right.Bytes.AsSpan(0, right.TypeSize));
}
}

0 comments on commit 1a50224

Please sign in to comment.