Пример #1
0
        public unsafe static void Write <T>(AMemory Memory, long Position, T Value) where T : struct
        {
            long Size = Marshal.SizeOf <T>();

            Memory.EnsureRangeIsValid(Position, Size);

            IntPtr Ptr = (IntPtr)Memory.TranslateWrite(Position);

            Marshal.StructureToPtr <T>(Value, Ptr, false);
        }
Пример #2
0
        public unsafe static T Read <T>(AMemory Memory, long Position) where T : struct
        {
            long Size = Marshal.SizeOf <T>();

            Memory.EnsureRangeIsValid(Position, Size);

            IntPtr Ptr = (IntPtr)Memory.Translate(Position);

            return(Marshal.PtrToStructure <T>(Ptr));
        }