using System.Runtime.CompilerServices; namespace Ryujinx.Common.Memory.PartialUnmaps { static class PartialUnmapHelpers { /// /// Calculates a byte offset of a given field within a struct. /// /// Struct type /// Field type /// Parent struct /// Field /// The byte offset of the given field in the given struct public static int OffsetOf(ref T2 storage, ref T target) { return (int)Unsafe.ByteOffset(ref Unsafe.As(ref storage), ref target); } } }