示例#1
0
        /// <summary>
        /// Writes a single element to the memory location, taking into account the alignment.
        /// </summary>
        /// <typeparam name="T">Struct type</typeparam>
        /// <param name="pDest">Pointer to memory location</param>
        /// <param name="data">The value to write</param>
        public static unsafe void WriteAligned <T>(IntPtr pDest, ref T data) where T : struct
        {
            int pad = (int)(pDest.ToInt64() % (long)IntPtr.Size);

            InternalInterop.WriteInline <T>((void *)AddIntPtr(pDest, pad), ref data);
        }
示例#2
0
 /// <summary>
 /// Writes a single element to the memory location.
 /// </summary>
 /// <typeparam name="T">Struct type</typeparam>
 /// <param name="pDest">Pointer to memory location</param>
 /// <param name="data">The value to write</param>
 public static unsafe void Write <T>(IntPtr pDest, ref T data) where T : struct
 {
     InternalInterop.WriteInline <T>((void *)pDest, ref data);
 }