Exemplo n.º 1
0
        private void _CopyHtoD <T>(IntPtr dest, T[] data)
        {
            int    byteSize = Marshal.SizeOf(typeof(T)) * data.Length;
            IntPtr ptr      = Marshal.AllocHGlobal(byteSize);

            MarshalUtil.Copy <T>(data, 0, ptr, data.Length);

            Driver.MemcpyHtoD(dest, ptr, byteSize);
            Marshal.FreeHGlobal(ptr);
        }
Exemplo n.º 2
0
        private T[] _CopyDtoH <T>(IntPtr src, int count)
        {
            int    byteSize = Marshal.SizeOf(typeof(T)) * count;
            IntPtr ptr      = Marshal.AllocHGlobal(byteSize);

            Driver.MemcpyDtoH(ptr, src, byteSize);

            T[] dest = new T[count];
            MarshalUtil.Copy <T>(ptr, dest, 0, count);
            Marshal.FreeHGlobal(ptr);
            return(dest);
        }