/** Creates a new long buffer by wrapping the given long array. * <p> * Calling this method has the same effect as {@code wrap(array, 0, array.length)}. * </p> * * @param array the long array which the new buffer will be based on. * @return the created long buffer. * @since Android 1.0 */ public static LongBuffer wrap (long[] array) { return wrap(array, 0, array.length); }
/** Creates a new long buffer by wrapping the given long array. * <p> * Calling this method has the same effect as {@code wrap(array, 0, array.length)}. * </p> * * @param array the long array which the new buffer will be based on. * @return the created long buffer. * @since Android 1.0 */ public static LongBuffer wrap (long[] array) { return wrap(array, 0, array.length); }
/** * Creates a new long buffer by wrapping the given long array. * <p> * Calling this method has the same effect as * {@code wrap(array, 0, array.length)}. * * @param array * the long array which the new buffer will be based on. * @return the created long buffer. */ public static LongBuffer wrap(long[] array) { return wrap(array, 0, array.length); }
private static MappeableContainer containerOf(final int from, final int to, final int blockCardinality, final long[] words) { // find the best container available if (blockCardinality <= MappeableArrayContainer.DEFAULT_MAX_SIZE) { // containers with DEFAULT_MAX_SIZE or less integers should be // ArrayContainers return arrayContainerOf(from, to, blockCardinality, words); } else { // otherwise use bitmap container return new MappeableBitmapContainer( LongBuffer.wrap(Arrays.copyOfRange(words, from, from + BLOCK_LENGTH)), blockCardinality); } }
@Setup public void init() { long[] bitmap = new long[1024]; int cardinality = 0; int targetCardinality = (int)(density * 65536); ThreadLocalRandom random = ThreadLocalRandom.current(); while (cardinality < targetCardinality) { int index = random.nextInt(65536); long before = bitmap[index >>> 6]; bitmap[index >>> 6] |= (1L << index); cardinality += Long.bitCount(before ^ bitmap[index >>> 6]); } container = new BitmapContainer(bitmap, cardinality); bufferContainer = new MappeableBitmapContainer(LongBuffer.wrap(bitmap), cardinality); }
/** * Serializes bitmap array data as a LongBuffer. * * @return Serialized bitmap array data as LongBuffer. */ public LongBuffer getLongBuffer() { return LongBuffer.wrap(data); } }
/** Creates a new long buffer by wrapping the given long array. * <p> * Calling this method has the same effect as {@code wrap(array, 0, array.length)}. * </p> * * @param array the long array which the new buffer will be based on. * @return the created long buffer. * @since Android 1.0 */ public static LongBuffer wrap (long[] array) { return wrap(array, 0, array.length); }
package org.jocl; import java.nio.LongBuffer; public class cl_device_partition_property_gateway { public static void set(cl_device_partition_property properties, long[] newArray) { properties.setBuffer(LongBuffer.wrap(newArray)); } }
public static GPTPartitionType getType(long typeGUIDMsb, long typeGUIDLsb) { GPTPartitionType type = reverseLookupTable.get(LongBuffer.wrap(new long[] {typeGUIDMsb, typeGUIDLsb})); if (type != null) return type; else return UNKNOWN_PARTITION_TYPE; }
/** * Read from a Tensor named {@link outputName} and copy the contents into a Java array. {@link * dst} must have length greater than or equal to that of the source Tensor. This operation will * not affect dst's content past the source Tensor's size. */ public void fetch(String outputName, long[] dst) { fetch(outputName, LongBuffer.wrap(dst)); }
/** * Creates a new Pointer to the given values. * The values may not be null. * * @param values The values the pointer should point to * @return The pointer */ public static Pointer to(long values[]) { return new Pointer(LongBuffer.wrap(values)); }
private GPTPartitionType(long typeGUIDMsb, long typeGUIDLsb, PartitionType enumType) { this.typeGUIDMsb = typeGUIDMsb; this.typeGUIDLsb = typeGUIDLsb; this.enumType = enumType; addReverseLookupReference(LongBuffer.wrap(new long[] {typeGUIDMsb, typeGUIDLsb}), this); }
protected long[] loadData( final ByteBuffer bytes, final int numElements ) { final long[] data = new long[ numElements ]; LongBuffer.wrap( data, 0, numElements ).put( bytes.asLongBuffer() ); return data; }
@Override public void save( final A access, final ByteBuffer out, final int numElements ) { final long[] data = access.getCurrentStorageArray(); out.asLongBuffer().put( LongBuffer.wrap( data, 0, numElements ) ); } }
/** * Given a source array with shape {@link dims} and content {@link src}, copy the contents into * the input Tensor with name {@link inputName}. The source array {@link src} must have at least * as many elements as that of the destination Tensor. If {@link src} has more elements than the * destination has capacity, the copy is truncated. */ public void feed(String inputName, long[] src, long... dims) { addFeed(inputName, Tensor.create(dims, LongBuffer.wrap(src))); }
/** Returns a non direct PointerBuffer in native order, having a backup array */ public static PointerBuffer allocate(final int size) { if (Platform.is32Bit()) { return new PointerBuffer(IntBuffer.wrap(new int[size])); } else { return new PointerBuffer(LongBuffer.wrap(new long[size])); } }
@Test public void testCreateLongBuffer() { assertThat(ImmutableBitSet.valueOf(LongBuffer.wrap(new long[] {})), equalTo(ImmutableBitSet.of())); assertThat(ImmutableBitSet.valueOf(LongBuffer.wrap(new long[] {0xAL})), equalTo(ImmutableBitSet.of(1, 3))); assertThat( ImmutableBitSet.valueOf(LongBuffer.wrap(new long[] {0, 0, 0xAL, 0})), equalTo(ImmutableBitSet.of(129, 131))); }
@Test public void testCreateLongBuffer() { assertThat(ImmutableBitSet.valueOf(LongBuffer.wrap(new long[] {})), equalTo(ImmutableBitSet.of())); assertThat(ImmutableBitSet.valueOf(LongBuffer.wrap(new long[] {0xAL})), equalTo(ImmutableBitSet.of(1, 3))); assertThat( ImmutableBitSet.valueOf(LongBuffer.wrap(new long[] {0, 0, 0xAL, 0})), equalTo(ImmutableBitSet.of(129, 131))); }
@Test public void testToLongArray() { final ImmutableBitSet bitSet = ImmutableBitSet.of(29, 4, 1969); assertThat(ImmutableBitSet.valueOf(bitSet.toLongArray()), equalTo(bitSet)); assertThat(ImmutableBitSet.valueOf(LongBuffer.wrap(bitSet.toLongArray())), equalTo(bitSet)); }
@Test public void testToLongArray() { final ImmutableBitSet bitSet = ImmutableBitSet.of(29, 4, 1969); assertThat(ImmutableBitSet.valueOf(bitSet.toLongArray()), equalTo(bitSet)); assertThat(ImmutableBitSet.valueOf(LongBuffer.wrap(bitSet.toLongArray())), equalTo(bitSet)); }