Esempio n. 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;
            }
Esempio n. 2
0
 private static void ValidateArraySizes(ArrayModule.array array, int offset, int size) {
     ValidateArraySizes(array.__len__() * array.itemsize, offset, size);
 }
Esempio n. 3
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;
            }