Plane.cs 986 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Diagnostics.CodeAnalysis;
  3. namespace Ryujinx.Graphics.Video
  4. {
  5. public struct Plane : IEquatable<Plane>
  6. {
  7. public IntPtr Pointer { get; }
  8. public int Length { get; }
  9. public Plane(IntPtr pointer, int length)
  10. {
  11. Pointer = pointer;
  12. Length = length;
  13. }
  14. public override bool Equals(object obj)
  15. {
  16. return obj is Plane other && Equals(other);
  17. }
  18. public bool Equals([AllowNull] Plane other)
  19. {
  20. return Pointer == other.Pointer && Length == other.Length;
  21. }
  22. public override int GetHashCode()
  23. {
  24. return HashCode.Combine(Pointer, Length);
  25. }
  26. public static bool operator ==(Plane left, Plane right)
  27. {
  28. return left.Equals(right);
  29. }
  30. public static bool operator !=(Plane left, Plane right)
  31. {
  32. return !(left == right);
  33. }
  34. }
  35. }