示例#1
0
            public _Array from_buffer_copy(ArrayModule.array array, [DefaultParameterValue(0)]int offset) {
                ValidateArraySizes(array, offset, ((INativeType)this).Size);

                _Array res = (_Array)CreateInstance(Context.SharedContext);
                res._memHolder = new MemoryHolder(((INativeType)this).Size);
                res._memHolder.CopyFrom(array.GetArrayAddress().Add(offset), new IntPtr(((INativeType)this).Size));
                GC.KeepAlive(array);
                return res;
            }
示例#2
0
            public _Array from_buffer(ArrayModule.array array, [DefaultParameterValue(0)]int offset) {
                ValidateArraySizes(array, offset, ((INativeType)this).Size);

                _Array res = (_Array)CreateInstance(Context.SharedContext);
                IntPtr addr = array.GetArrayAddress();
                res._memHolder = new MemoryHolder(addr.Add(offset), ((INativeType)this).Size);
                res._memHolder.AddObject("ffffffff", array);
                return res;
            }