示例#1
0
        /// <summary>
        /// Reads a single element from the memory location, taking into account the alignment.
        /// </summary>
        /// <typeparam name="T">Struct type</typeparam>
        /// <param name="pSrc">Pointer to memory location</param>
        /// <returns>The read value</returns>
        public static unsafe T ReadAligned <T>(IntPtr pSrc) where T : struct
        {
            int pad = (int)(pSrc.ToInt64() % (long)IntPtr.Size);

            return(InternalInterop.ReadInline <T>((void *)AddIntPtr(pSrc, pad)));
        }
示例#2
0
 /// <summary>
 /// Reads a single element from the memory location.
 /// </summary>
 /// <typeparam name="T">Struct type</typeparam>
 /// <param name="pSrc">Pointer to memory location</param>
 /// <returns>The read value</returns>
 public static unsafe T Read <T>(IntPtr pSrc) where T : struct
 {
     return(InternalInterop.ReadInline <T>((void *)pSrc));
 }