/** @return the i-th {@code long long} of a native array */ public native long get(long i); /** @return {@code put(0, l)} */
/** @return {@code get(array, 0, array.length)} */ public LongPointer get(long[] array) { return get(array, 0, array.length); } /** @return {@code put(array, 0, array.length)} */
@Override public long nextLong() { long next = 0; synchronized (this) { if (position.get() >= numberOfElements) { position.set(0); generation++; } next = hostPointer.get(position.getAndIncrement()); if (generation > 1) next = next ^ generation + 11; if (amplifier != seed) next = next ^ amplifier + 11; } return next < 0 ? -1 * next : next; }
/** * Creates a long 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 long indexer backed by the raw memory interface, a buffer, or an array */ public static LongIndexer create(final LongPointer pointer, long[] sizes, long[] strides, boolean direct) { if (direct) { return Raw.getInstance() != null ? new LongRawIndexer(pointer, sizes, strides) : new LongBufferIndexer(pointer.asBuffer(), sizes, strides); } else { final long position = pointer.position(); long[] array = new long[(int)Math.min(pointer.limit() - position, Integer.MAX_VALUE)]; pointer.get(array); return new LongArrayIndexer(array, sizes, strides) { @Override public void release() { pointer.position(position).put(array); super.release(); } }; } }
@Override public long nextLong() { long next = 0; synchronized (this) { if (position.get() >= numberOfElements) { position.set(0); generation++; } next = hostPointer.get(position.getAndIncrement()); if (generation > 1) next = next ^ generation + 11; if (amplifier != seed) next = next ^ amplifier + 11; } return next < 0 ? -1 * next : next; }
/** * Get all supported channel layouts by this {@code Codec}. If this {@code Codec} * is not an audio codec, then {@code null} is returned. * * @return all supported channel layouts by this {@code Codec}. */ public ChannelLayout[] getSupportedChannelLayouts() { LongPointer layoutsPointer = avCodec.channel_layouts(); if (getType() != MediaType.AUDIO || layoutsPointer == null) return null; List<ChannelLayout> layouts = new ArrayList<ChannelLayout>(); long layout; int index = 0; while ((layout = layoutsPointer.get(index++)) != 0) layouts.add(ChannelLayout.byId(layout)); return layouts.toArray(new ChannelLayout[0]); }
val buffer = var.getNDArray().buffer(); val rank = (int) shapeInfo.get(0); val jshape = new long[rank * 2 + 4]; for (int i = 0; i < jshape.length; i++) { jshape[i] = shapeInfo.get(i); val buffer = var.getNDArray().buffer(); val rank = (int) shapeInfo.get(0); val jshape = new long[rank * 2 + 4]; for (int i = 0; i < jshape.length; i++) { jshape[i] = shapeInfo.get(i); val buffer = var.getNDArray().buffer(); val rank = (int) shapeInfo.get(0); val jshape = new long[rank * 2 + 4]; for (int i = 0; i < jshape.length; i++) { jshape[i] = shapeInfo.get(i);