using System; using System.Runtime.InteropServices; namespace UnityEngine.XR.ARKit { [StructLayout(LayoutKind.Sequential)] internal struct MemoryLayout : IEquatable { /// /// The number of bytes required to store a single session relative data object /// public int size; /// /// The number of bytes between consecutive elements in an array of session relative data objects /// public int stride; /// /// The alignment required by a session relative data object /// public int alignment; public override int GetHashCode() { unchecked { int hash = size.GetHashCode(); hash = hash * 486187739 + stride.GetHashCode(); hash = hash * 486187739 + alignment.GetHashCode(); return hash; } } public bool Equals(MemoryLayout other) { return (size == other.size) && (stride == other.stride) && (alignment == other.alignment); } public override bool Equals(object obj) => (obj is MemoryLayout) && Equals((MemoryLayout)obj); public static bool operator ==(MemoryLayout lhs, MemoryLayout rhs) => lhs.Equals(rhs); public static bool operator !=(MemoryLayout lhs, MemoryLayout rhs) => !lhs.Equals(rhs); } }