blob: aaaf4fd31bd0aca822760d4b4ae304a551bf0ead (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System;
using System.Diagnostics.CodeAnalysis;
namespace Spv.Generator
{
internal readonly struct TypeDeclarationKey : IEquatable<TypeDeclarationKey>
{
private readonly Instruction _typeDeclaration;
public TypeDeclarationKey(Instruction typeDeclaration)
{
_typeDeclaration = typeDeclaration;
}
public override int GetHashCode()
{
return DeterministicHashCode.Combine(_typeDeclaration.Opcode, _typeDeclaration.GetHashCodeContent());
}
public bool Equals(TypeDeclarationKey other)
{
return _typeDeclaration.Opcode == other._typeDeclaration.Opcode && _typeDeclaration.EqualsContent(other._typeDeclaration);
}
public override bool Equals([NotNullWhen(true)] object obj)
{
return obj is TypeDeclarationKey key && Equals(key);
}
}
}
|