Ryujinx/Spv.Generator/DeterministicStringKey.cs
riperiperi bf94f4c7d6 Some optimizations to Spv.Generator
- Dictionary for lookups of type declarations, constants, extinst
- LiteralInteger internal data format -> ushort
- Deterministic HashCode implementation to avoid spirv result not being the same between runs
- Inline operand list instead of List<T>, falls back to array if many operands. (large performance boost)

TODO: improve instruction allocation, structured program creator, ssa?
2022-06-17 22:42:43 +01:00

30 lines
732 B
C#

using System;
using System.Diagnostics.CodeAnalysis;
namespace Spv.Generator
{
internal class DeterministicStringKey : IEquatable<DeterministicStringKey>
{
private string _value;
public DeterministicStringKey(string value)
{
_value = value;
}
public override int GetHashCode()
{
return DeterministicHashCode.GetHashCode(_value);
}
public bool Equals(DeterministicStringKey other)
{
return _value == other._value;
}
public override bool Equals([NotNullWhen(true)] object obj)
{
return obj is DeterministicStringKey && Equals((DeterministicStringKey)obj);
}
}
}