コード例 #1
0
 public static void BlockCopy(void* from, LocalAllocHandle to, uint byteCount)
 {
     bool refAdded = false;
     try
     {
         to.DangerousAddRef(ref refAdded);
         BlockCopy(from, (void*)to.DangerousGetHandle(), byteCount);
     }
     finally
     {
         if (refAdded)
         {
             to.DangerousRelease();
         }
     }
 }
コード例 #2
0
 public static void BlockCopy(LocalAllocHandle from, void* to, uint byteCount)
 {
     bool refAdded = false;
     try
     {
         from.DangerousAddRef(ref refAdded);
         BlockCopy((void*)from.DangerousGetHandle(), to, byteCount);
     }
     finally
     {
         if (refAdded)
         {
             from.DangerousRelease();
         }
     }
 }
コード例 #3
0
        public static void BlockCopy(LocalAllocHandle from, LocalAllocHandle to, IntPtr length)
        {
            if (length == IntPtr.Zero)
            {
                return;
            }

            bool fromRefAdded = false;
            bool toRefAdded = false;
            try
            {
                from.DangerousAddRef(ref fromRefAdded);
                to.DangerousAddRef(ref toRefAdded);
                if (sizeof(IntPtr) == 4)
                {
                    BlockCopyCore(from: (byte*)from.DangerousGetHandle(), to: (byte*)to.DangerousGetHandle(), byteCount: (uint)length.ToInt32());
                }
                else
                {
                    BlockCopyCore(from: (byte*)from.DangerousGetHandle(), to: (byte*)to.DangerousGetHandle(), byteCount: (ulong)length.ToInt64());
                }
            }
            finally
            {
                if (fromRefAdded)
                {
                    from.DangerousRelease();
                }
                if (toRefAdded)
                {
                    to.DangerousRelease();
                }
            }
        }