SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

4 years ago
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace UnityEngine.XR.ARKit
  4. {
  5. [StructLayout(LayoutKind.Sequential)]
  6. internal struct MemoryLayout : IEquatable<MemoryLayout>
  7. {
  8. /// <summary>
  9. /// The number of bytes required to store a single session relative data object
  10. /// </summary>
  11. public int size;
  12. /// <summary>
  13. /// The number of bytes between consecutive elements in an array of session relative data objects
  14. /// </summary>
  15. public int stride;
  16. /// <summary>
  17. /// The alignment required by a session relative data object
  18. /// </summary>
  19. public int alignment;
  20. public override int GetHashCode()
  21. {
  22. unchecked
  23. {
  24. int hash = size.GetHashCode();
  25. hash = hash * 486187739 + stride.GetHashCode();
  26. hash = hash * 486187739 + alignment.GetHashCode();
  27. return hash;
  28. }
  29. }
  30. public bool Equals(MemoryLayout other)
  31. {
  32. return
  33. (size == other.size) &&
  34. (stride == other.stride) &&
  35. (alignment == other.alignment);
  36. }
  37. public override bool Equals(object obj) => (obj is MemoryLayout) && Equals((MemoryLayout)obj);
  38. public static bool operator ==(MemoryLayout lhs, MemoryLayout rhs) => lhs.Equals(rhs);
  39. public static bool operator !=(MemoryLayout lhs, MemoryLayout rhs) => !lhs.Equals(rhs);
  40. }
  41. }