-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAbstractSSAVariable.cs
More file actions
87 lines (70 loc) · 1.85 KB
/
Copy pathAbstractSSAVariable.cs
File metadata and controls
87 lines (70 loc) · 1.85 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
namespace BinaryNinja
{
public abstract class AbstractSSAVariable<T_VARIABLE>
: IEquatable< AbstractSSAVariable<T_VARIABLE>>,
IComparable< AbstractSSAVariable<T_VARIABLE>>
where T_VARIABLE : AbstractFunctionVariable<T_VARIABLE>
{
public T_VARIABLE Variable { get; }
public ulong Version { get; } = 0;
internal AbstractSSAVariable(T_VARIABLE variable , ulong version)
{
this.Variable = variable;
this.Version = version;
}
public override string ToString()
{
return $"{this.Variable.Name}#{this.Version}";
}
public override bool Equals(object? other)
{
return Equals(other as AbstractSSAVariable<T_VARIABLE> );
}
public bool Equals(AbstractSSAVariable<T_VARIABLE> ? other)
{
if (other is null)
{
return false;
}
if (ReferenceEquals(this , other))
{
return true;
}
if (this.Variable.Identifier != other.Variable.Identifier)
{
return false;
}
return this.Version == other.Version;
}
public override int GetHashCode()
{
return HashCode.Combine<ulong,ulong>(this.Variable.Identifier, this.Version);
}
public static bool operator ==(AbstractSSAVariable<T_VARIABLE> ? left, AbstractSSAVariable<T_VARIABLE> ? right)
{
if (left is null)
{
return right is null;
}
return left.Equals(right);
}
public static bool operator !=(AbstractSSAVariable<T_VARIABLE> ? left, AbstractSSAVariable<T_VARIABLE> ? right)
{
return !(left == right);
}
public int CompareTo(AbstractSSAVariable<T_VARIABLE> ? other)
{
if (other is null)
{
return 1;
}
int result = this.Variable.Identifier.CompareTo(other.Variable.Identifier);
if (result == 0)
{
result = this.Version.CompareTo(other.Version);
}
return result;
}
}
}