public MemoryView(IBufferProtocol @object) { _buffer = @object; _step = 1; _format = _buffer.Format; _itemsize = (int)_buffer.ItemSize; _matchesBuffer = true; var shape = _buffer.GetShape(_start, _end); if (shape == null) { _shape = null; } _shape = new PythonTuple(shape); }
public MemoryView([NotNull] IBufferProtocol @object) { _buffer = @object; _step = 1; _format = _buffer.Format; _isReadOnly = _buffer.ReadOnly; _itemsize = (int)_buffer.ItemSize; _matchesBuffer = true; var shape = _buffer.GetShape(_start, _end); if (shape != null) { _shape = new PythonTuple(shape); } else { _shape = PythonTuple.MakeTuple(_buffer.ItemCount); } }