@Override public ByteIndexer putDouble(long i, double d) { RAW.putDouble(base + checkIndex(i, size - 7), d); return this; }
@Override public ByteIndexer put(long i, long j, byte b) { put(i * strides[0] + j, b); return this; } @Override public ByteIndexer put(long i, long j, byte[] b, int offset, int length) {
@Override public ByteIndexer get(long i, long j, byte[] b, int offset, int length) { for (int n = 0; n < length; n++) { b[offset + n] = get(i * strides[0] + j * strides[1] + n); } return this; } @Override public byte get(long i, long j, long k) {
/** * Creates a byte indexer to access efficiently the data of a pointer. * * @param pointer data to access via a buffer or to copy to an array * @param direct {@code true} to use a direct buffer, see {@link Indexer} for details * @return the new byte indexer backed by the raw memory interface, a buffer, or an array */ public static ByteIndexer create(final BytePointer pointer, long[] sizes, long[] strides, boolean direct) { if (direct) { return Raw.getInstance() != null ? new ByteRawIndexer(pointer, sizes, strides) : new ByteBufferIndexer(pointer.asBuffer(), sizes, strides); } else { final long position = pointer.position(); byte[] array = new byte[(int)Math.min(pointer.limit() - position, Integer.MAX_VALUE)]; pointer.get(array); return new ByteArrayIndexer(array, sizes, strides) { @Override public void release() { pointer.position(position).put(array); super.release(); } }; } }
@Override public ByteIndexer put(long i, byte b) { RAW.putByte(base + checkIndex(i, size), b); return this; } @Override public ByteIndexer put(long i, byte[] b, int offset, int length) {
@Override public ByteIndexer put(long i, long j, long k, byte b) { put(i * strides[0] + j * strides[1] + k, b); return this; } @Override public ByteIndexer put(long[] indices, byte b) {
@Override public ByteIndexer get(long i, byte[] b, int offset, int length) { for (int n = 0; n < length; n++) { b[offset + n] = get(i * strides[0] + n); } return this; } @Override public byte get(long i, long j) {
@Override public ByteIndexer putShort(long i, short s) { RAW.putShort(base + checkIndex(i, size - 1), s); return this; }
@Override public ByteIndexer put(long i, long j, byte[] b, int offset, int length) { for (int n = 0; n < length; n++) { put(i * strides[0] + j * strides[1] + n, b[offset + n]); } return this; } @Override public ByteIndexer put(long i, long j, long k, byte b) {
@Override public byte get(long i, long j) { return get(i * strides[0] + (int)j); } @Override public ByteIndexer get(long i, long j, byte[] b, int offset, int length) {
@Override public float getFloat(long i) { return RAW.getFloat(base + checkIndex(i, size - 3)); } @Override public ByteIndexer putFloat(long i, float f) {
@Override public ByteIndexer put(long i, byte[] b, int offset, int length) { for (int n = 0; n < length; n++) { put(i * strides[0] + n, b[offset + n]); } return this; } @Override public ByteIndexer put(long i, long j, byte b) {
@Override public byte get(long i, long j, long k) { return get(i * strides[0] + j * strides[1] + k); } @Override public byte get(long... indices) {
@Override public char getChar(long i) { return RAW.getChar(base + checkIndex(i, size - 1)); } @Override public ByteIndexer putChar(long i, char c) {
@Override public ByteIndexer putInt(long i, int j) { RAW.putInt(base + checkIndex(i, size - 3), j); return this; }
@Override public long getLong(long i) { return RAW.getLong(base + checkIndex(i, size - 7)); } @Override public ByteIndexer putLong(long i, long j) {