/** * Create a copy of the content of this container as a long array. This creates a copy. * * @return copy of the content as a long array */ public long[] toLongArray() { long[] answer = new long[bitmap.limit()]; bitmap.rewind(); bitmap.get(answer); return answer; }
@SuppressWarnings("WeakerAccess") public static int decompress(LongBuffer compressedBuffer, long[] unCompressedData) { int totalOut = 0; compressedBuffer.rewind(); int unComprSize = unCompressedData.length; while (unComprSize > 0) { final int decoded = decompressSingle(compressedBuffer.get(), unCompressedData, totalOut); unComprSize -= decoded; totalOut += decoded; } return totalOut; }
private long getInfoSize(int param) { Utils.tempBuffers[0].b16l.rewind(); int ret = cl.clGetImageInfo(id, param, 8, Utils.tempBuffers[0].b16l, null); Utils.checkError(ret, "clGetImageInfo"); return Utils.tempBuffers[0].b16l.get(0); }
@Override public long getMaxWorkGroupSize(Device device) { long d = ((JoclDevice) device).id; Utils.tempBuffers[0].b16l.rewind(); int ret = cl.clGetKernelWorkGroupInfo(kernel, d, CL.CL_KERNEL_WORK_GROUP_SIZE, 8, Utils.tempBuffers[0].b16l, null); Utils.checkError(ret, "clGetKernelWorkGroupInfo"); return Utils.tempBuffers[0].b16l.get(0); }
@Override public void setArg(int index, Buffer t) { Utils.tempBuffers[0].b16l.rewind(); Utils.tempBuffers[0].b16l.put(0, ((JoclBuffer) t).id); int ret = cl.clSetKernelArg(kernel, index, is32Bit()?4:8, Utils.tempBuffers[0].b16l); Utils.checkError(ret, "clSetKernelArg"); }
@Override public void setArg(int index, Image i) { Utils.tempBuffers[0].b16l.rewind(); Utils.tempBuffers[0].b16l.put(0, ((JoclImage) i).id); int ret = cl.clSetKernelArg(kernel, index, is32Bit()?4:8, Utils.tempBuffers[0].b16l); Utils.checkError(ret, "clSetKernelArg"); }
MappeableBitmapContainer(int newCardinality, LongBuffer newBitmap) { this.cardinality = newCardinality; LongBuffer tmp = newBitmap.duplicate(); // for thread safety this.bitmap = LongBuffer.allocate(tmp.limit()); tmp.rewind(); this.bitmap.put(tmp); }
@Override public Image createImage(MemoryAccess access, ImageFormat format, ImageDescriptor descr) { long memFlags = Utils.getMemoryAccessFlags(access); Utils.errorBuffer.rewind(); //fill image format Utils.tempBuffers[0].b16i.rewind(); Utils.tempBuffers[0].b16i.put(LwjglImage.decodeImageChannelOrder(format.channelOrder)) .put(LwjglImage.decodeImageChannelType(format.channelType)); Utils.tempBuffers[0].b16.rewind(); //fill image desc Utils.b80l.rewind(); Utils.b80l.put(LwjglImage.decodeImageType(descr.type)) .put(descr.width).put(descr.height).put(descr.depth) .put(descr.arraySize).put(descr.rowPitch).put(descr.slicePitch) .put(0).put(0).put(0); Utils.b80.rewind(); //create image CLMem mem = CL12.clCreateImage(context, memFlags, Utils.tempBuffers[0].b16, Utils.b80, descr.hostPtr, Utils.errorBuffer); Utils.checkError(Utils.errorBuffer, "clCreateImage"); return new LwjglImage(mem); }
public void setFromBuffer(LongBuffer buffer) { buffer.rewind(); secs = buffer.get(); nsecs = buffer.get(); }
public void setFromBuffer(LongBuffer buffer) { buffer.rewind(); secs = buffer.get(); nsecs = buffer.get(); }
public void setFromBuffer(LongBuffer buffer) { buffer.rewind(); secs = buffer.get(); nsecs = buffer.get(); }
/** * Create a copy of the content of this container as a long array. This creates a copy. * * @return copy of the content as a long array */ public long[] toLongArray() { long[] answer = new long[bitmap.limit()]; bitmap.rewind(); bitmap.get(answer); return answer; }
@Override void sort(TypedArrayObject typedArray) { LongBuffer data = asLongBuffer(typedArray); long[] ba = new long[data.remaining()]; data.get(ba); Arrays.sort(ba); data.rewind(); data.put(ba); }
/** * Get a copy of this ImmutableBitSet as a mutable BitSet. * @return a copy */ public BitSet asBitSet() { BitSet bs = new BitSet(this.size()); this.data.rewind(); this.data.get(bs.data, 0, bs.data.length); return bs; }
/** * Get a copy of this ImmutableBitSet as a mutable BitSet. * @return a copy */ public BitSet asBitSet() { BitSet bs = new BitSet(this.size()); this.data.rewind(); this.data.get(bs.data, 0, bs.data.length); return bs; }
@Override void sort(TypedArrayObject typedArray, Comparator<Number> comparator) { LongBuffer data = asLongBuffer(typedArray); long[] ba = new long[data.remaining()]; data.get(ba); sortArrayAsBigInt(ba, BigInteger::valueOf, comparator); data.rewind(); data.put(ba); }
@Override void sort(TypedArrayObject typedArray, Comparator<Number> comparator) { LongBuffer data = asLongBuffer(typedArray); long[] ba = new long[data.remaining()]; data.get(ba); sortArrayAsBigInt(ba, BigIntType::toUnsigned64, comparator); data.rewind(); data.put(ba); }
@Override void sort(TypedArrayObject typedArray) { LongBuffer data = asLongBuffer(typedArray); long[] ba = new long[data.remaining()]; data.get(ba); sortArrayUnsigned(ba); data.rewind(); data.put(ba); }
MappeableBitmapContainer(int newCardinality, LongBuffer newBitmap) { this.cardinality = newCardinality; LongBuffer tmp = newBitmap.duplicate(); // for thread safety this.bitmap = LongBuffer.allocate(tmp.limit()); tmp.rewind(); this.bitmap.put(tmp); }
public void add(long value) throws IOException { if (! endBuffer.hasRemaining()) { endBuffer.rewind(); flattener.write(StupidResourceHolder.create(endBuffer)); endBuffer = LongBuffer.allocate(sizePer); endBuffer.mark(); } endBuffer.put(value); ++numInserted; }