using System; using System.Collections.Generic; namespace ComputeSharp.D2D1Interop.SourceGenerators.Models; /// /// A model representing gathered info on a embedded thread ids. /// /// Whether the values are diascarded. /// The thread ids value for the X axis. /// The thread ids value for the Y axis. /// The thread ids value for the Z axis. internal sealed record ThreadIdsInfo(bool IsDefault, int X, int Y, int Z) { /// /// An implementation for . /// public sealed class Comparer : IEqualityComparer { /// /// The singleton instance. /// public static Comparer Default { get; } = new(); /// public bool Equals(ThreadIdsInfo? x, ThreadIdsInfo? y) { if (x is null && y is null) { return true; } if (x is null || y is null) { return false; } if (ReferenceEquals(x, y)) { return true; } return x.IsDefault == y.IsDefault && x.X == y.X && x.Y == y.Y && x.Z == y.Y; } /// public int GetHashCode(ThreadIdsInfo obj) { return HashCode.Combine(obj.IsDefault, obj.X, obj.Y, obj.Z); } } }