Remove unused equality extensions

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-20 03:28:45 +02:00
1 親 ac89019292
コミット 95f5cd28fc
3ファイル変更
-92

検索条件に一致するファイルはありません

-2
ファイルの表示
@@ -13,8 +13,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Extensions\IncrementalValueProviderExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\CompilationExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\DiagnosticsExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\HashCodeExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ImmutableArrayExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ISymbolExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\EquatableArray{T}.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\HashCode.cs" />
-40
ファイルの表示
@@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace ComputeSharp.SourceGeneration.Extensions;
/// <summary>
/// Extension methods for <see cref="HashCode"/>.
/// </summary>
internal static class HashCodeExtensions
{
/// <summary>
/// Adds all items from a given <see cref="ImmutableArray{T}"/> instance to an hashcode.
/// </summary>
/// <typeparam name="T">The type of items to hash.</typeparam>
/// <param name="hashCode">The target <see cref="HashCode"/> instance.</param>
/// <param name="items">The input items to hash.</param>
public static void AddRange<T>(this ref HashCode hashCode, ImmutableArray<T> items)
{
foreach (T item in items)
{
hashCode.Add(item);
}
}
/// <summary>
/// Adds all items from a given <see cref="ImmutableArray{T}"/> instance to an hashcode.
/// </summary>
/// <typeparam name="T">The type of items to hash.</typeparam>
/// <param name="hashCode">The target <see cref="HashCode"/> instance.</param>
/// <param name="comparer">A comparer to get hashcodes for <typeparamref name="T"/> items.</param>
/// <param name="items">The input items to hash.</param>
public static void AddRange<T>(this ref HashCode hashCode, ImmutableArray<T> items, IEqualityComparer<T> comparer)
{
foreach (T item in items)
{
hashCode.Add(item, comparer);
}
}
}
-50
ファイルの表示
@@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace ComputeSharp.SourceGeneration.Extensions;
/// <summary>
/// Extension methods for <see cref="ImmutableArray{T}"/>.
/// </summary>
internal static class ImmutableArrayExtensions
{
/// <summary>
/// Compares two sequences for equality.
/// </summary>
/// <typeparam name="T">The items to compare.</typeparam>
/// <param name="left">The left sequence of items.</param>
/// <param name="right">The right sequence of items.</param>
/// <returns>Whether or not <paramref name="left"/> equals <paramref name="right"/>.</returns>
public static bool SequenceEqual<T>(this ImmutableArray<T> left, ImmutableArray<T> right)
where T : IEquatable<T>
{
return left.AsSpan().SequenceEqual(right.AsSpan());
}
/// <summary>
/// Compares two sequences for equality.
/// </summary>
/// <typeparam name="T">The items to compare.</typeparam>
/// <param name="left">The left sequence of items.</param>
/// <param name="right">The right sequence of items.</param>
/// <param name="comparer">The <see cref="IEqualityComparer{T}"/> instance used to compare <typeparamref name="T"/> items.</param>
/// <returns>Whether or not <paramref name="left"/> equals <paramref name="right"/>.</returns>
public static bool SequenceEqual<T>(this ImmutableArray<T> left, ImmutableArray<T> right, IEqualityComparer<T> comparer)
{
if (left.Length != right.Length)
{
return false;
}
for (int i = 0; i < left.Length; i++)
{
if (!comparer.Equals(left[i], right[i]))
{
return false;
}
}
return true;
}
}