< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java
Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level
rev 54660 : Javadoc changes
*** 122,151 ****
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(VectorSpecies<Byte>, ByteBuffer, int, VectorMask) method} as follows:
* <pre>{@code
! * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
* }</pre>
*
* @param species species of desired vector
* @param a the byte array
! * @param ix the offset into the array
* @return a vector loaded from a byte array
* @throws IndexOutOfBoundsException if {@code i < 0} or
! * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector fromByteArray(VectorSpecies<Byte> species, byte[] a, int ix) {
Objects.requireNonNull(a);
! ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
! a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
! a, ix, species,
(c, idx, s) -> {
ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
ByteBuffer tb = bbc;
return ((ByteSpecies)s).op(i -> tb.get());
});
--- 122,151 ----
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
* <pre>{@code
! * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
* }</pre>
*
* @param species species of desired vector
* @param a the byte array
! * @param offset the offset into the array
* @return a vector loaded from a byte array
* @throws IndexOutOfBoundsException if {@code i < 0} or
! * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector fromByteArray(VectorSpecies<Byte> species, byte[] a, int offset) {
Objects.requireNonNull(a);
! offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
! a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
! a, offset, species,
(c, idx, s) -> {
ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
ByteBuffer tb = bbc;
return ((ByteSpecies)s).op(i -> tb.get());
});
*** 158,289 ****
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform.
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(VectorSpecies<Byte>, ByteBuffer, int, VectorMask) method} as follows:
* <pre>{@code
! * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
* }</pre>
*
* @param species species of desired vector
* @param a the byte array
! * @param ix the offset into the array
* @param m the mask
* @return a vector loaded from a byte array
! * @throws IndexOutOfBoundsException if {@code i < 0} or
! * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
! * @throws IndexOutOfBoundsException if the offset is {@code < 0},
! * or {@code > a.length},
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
! * {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static ByteVector fromByteArray(VectorSpecies<Byte> species, byte[] a, int ix, VectorMask<Byte> m) {
! return zero(species).blend(fromByteArray(species, a, ix), m);
}
/**
* Loads a vector from an array starting at offset.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
! * array element at index {@code i + N} is placed into the
* resulting vector at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param i the offset into the array
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code i < 0}, or
! * {@code i > a.length - this.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int i){
Objects.requireNonNull(a);
! i = VectorIntrinsics.checkIndex(i, a.length, species.length());
return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
! a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
! a, i, species,
(c, idx, s) -> ((ByteSpecies)s).op(n -> c[idx + n]));
}
/**
* Loads a vector from an array starting at offset and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the array element at
! * index {@code i + N} is placed into the resulting vector at lane index
* {@code N}, otherwise the default element value is placed into the
* resulting vector at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param i the offset into the array
* @param m the mask
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
! * is set {@code i > a.length - N}
*/
@ForceInline
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int i, VectorMask<Byte> m) {
! return zero(species).blend(fromArray(species, a, i), m);
}
/**
* Loads a vector from an array using indexes obtained from an index
* map.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
! * array element at index {@code i + indexMap[j + N]} is placed into the
* resulting vector at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param i the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param indexMap the index map
! * @param j the offset into the index map
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code j < 0}, or
! * {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} the result of
! * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
*/
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int i, int[] indexMap, int j) {
! return ((ByteSpecies)species).op(n -> a[i + indexMap[j + n]]);
}
/**
* Loads a vector from an array using indexes obtained from an index
* map and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the array element at
! * index {@code i + indexMap[j + N]} is placed into the resulting vector
* at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param i the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param m the mask
* @param indexMap the index map
! * @param j the offset into the index map
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code j < 0}, or
! * {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} where the mask at lane
! * {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int i, VectorMask<Byte> m, int[] indexMap, int j) {
! return ((ByteSpecies)species).op(m, n -> a[i + indexMap[j + n]]);
}
/**
* Loads a vector from a {@link ByteBuffer byte buffer} starting at an
* offset into the byte buffer.
--- 158,286 ----
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform.
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
* <pre>{@code
! * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m);
* }</pre>
*
* @param species species of desired vector
* @param a the byte array
! * @param offset the offset into the array
* @param m the mask
* @return a vector loaded from a byte array
! * @throws IndexOutOfBoundsException if {@code offset < 0} or
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
! * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static ByteVector fromByteArray(VectorSpecies<Byte> species, byte[] a, int offset, VectorMask<Byte> m) {
! return zero(species).blend(fromByteArray(species, a, offset), m);
}
/**
* Loads a vector from an array starting at offset.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
! * array element at index {@code offset + N} is placed into the
* resulting vector at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param offset the offset into the array
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code offset < 0}, or
! * {@code offset > a.length - species.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int offset){
Objects.requireNonNull(a);
! offset = VectorIntrinsics.checkIndex(offset, a.length, species.length());
return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
! a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
! a, offset, species,
(c, idx, s) -> ((ByteSpecies)s).op(n -> c[idx + n]));
}
/**
* Loads a vector from an array starting at offset and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the array element at
! * index {@code offset + N} is placed into the resulting vector at lane index
* {@code N}, otherwise the default element value is placed into the
* resulting vector at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param offset the offset into the array
* @param m the mask
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code offset < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
! * is set {@code offset > a.length - N}
*/
@ForceInline
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int offset, VectorMask<Byte> m) {
! return zero(species).blend(fromArray(species, a, offset), m);
}
/**
* Loads a vector from an array using indexes obtained from an index
* map.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
! * array element at index {@code a_offset + indexMap[i_offset + N]} is placed into the
* resulting vector at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param a_offset the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param indexMap the index map
! * @param i_offset the offset into the index map
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
! * {@code i_offset > indexMap.length - species.length()},
* or for any vector lane index {@code N} the result of
! * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length}
*/
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int a_offset, int[] indexMap, int i_offset) {
! return ((ByteSpecies)species).op(n -> a[a_offset + indexMap[i_offset + n]]);
}
/**
* Loads a vector from an array using indexes obtained from an index
* map and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the array element at
! * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector
* at lane index {@code N}.
*
* @param species species of desired vector
* @param a the array
! * @param a_offset the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param m the mask
* @param indexMap the index map
! * @param i_offset the offset into the index map
* @return the vector loaded from an array
! * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
! * {@code i_offset > indexMap.length - species.length()},
* or for any vector lane index {@code N} where the mask at lane
! * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is
* {@code < 0} or {@code >= a.length}
*/
! public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int a_offset, VectorMask<Byte> m, int[] indexMap, int i_offset) {
! return ((ByteSpecies)species).op(m, n -> a[a_offset + indexMap[i_offset + n]]);
}
/**
* Loads a vector from a {@link ByteBuffer byte buffer} starting at an
* offset into the byte buffer.
*** 291,325 ****
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform.
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(VectorSpecies<Byte>, ByteBuffer, int, VectorMask)} method} as follows:
* <pre>{@code
! * return this.fromByteBuffer(b, i, this.maskAllTrue())
* }</pre>
*
* @param species species of desired vector
* @param bb the byte buffer
! * @param ix the offset into the byte buffer
* @return a vector loaded from a byte buffer
* @throws IndexOutOfBoundsException if the offset is {@code < 0},
* or {@code > b.limit()},
* or if there are fewer than
! * {@code this.length() * this.elementSize() / Byte.SIZE} bytes
* remaining in the byte buffer from the given offset
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector fromByteBuffer(VectorSpecies<Byte> species, ByteBuffer bb, int ix) {
if (bb.order() != ByteOrder.nativeOrder()) {
throw new IllegalArgumentException();
}
! ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
! U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix,
! bb, ix, species,
(c, idx, s) -> {
ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
ByteBuffer tb = bbc;
return ((ByteSpecies)s).op(i -> tb.get());
});
--- 288,322 ----
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform.
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows:
* <pre>{@code
! * return fromByteBuffer(b, offset, VectorMask.allTrue())
* }</pre>
*
* @param species species of desired vector
* @param bb the byte buffer
! * @param offset the offset into the byte buffer
* @return a vector loaded from a byte buffer
* @throws IndexOutOfBoundsException if the offset is {@code < 0},
* or {@code > b.limit()},
* or if there are fewer than
! * {@code species.length() * species.elementSize() / Byte.SIZE} bytes
* remaining in the byte buffer from the given offset
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector fromByteBuffer(VectorSpecies<Byte> species, ByteBuffer bb, int offset) {
if (bb.order() != ByteOrder.nativeOrder()) {
throw new IllegalArgumentException();
}
! offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
! U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset,
! bb, offset, species,
(c, idx, s) -> {
ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
ByteBuffer tb = bbc;
return ((ByteSpecies)s).op(i -> tb.get());
});
*** 333,457 ****
* {@link java.nio.Buffer buffer} for the primitive element type,
* according to the native byte order of the underlying platform, and
* the returned vector is loaded with a mask from a primitive array
* obtained from the primitive buffer.
* The following pseudocode expresses the behaviour, where
! * {@coce EBuffer} is the primitive buffer type, {@code e} is the
! * primitive element type, and {@code ESpecies<S>} is the primitive
* species for {@code e}:
* <pre>{@code
* EBuffer eb = b.duplicate().
! * order(ByteOrder.nativeOrder()).position(i).
* asEBuffer();
! * e[] es = new e[this.length()];
* for (int n = 0; n < t.length; n++) {
* if (m.isSet(n))
* es[n] = eb.get(n);
* }
! * Vector<E> r = ((ESpecies<S>)this).fromArray(es, 0, m);
* }</pre>
*
* @param species species of desired vector
* @param bb the byte buffer
! * @param ix the offset into the byte buffer
* @param m the mask
* @return a vector loaded from a byte buffer
* @throws IndexOutOfBoundsException if the offset is {@code < 0},
* or {@code > b.limit()},
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
! * {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static ByteVector fromByteBuffer(VectorSpecies<Byte> species, ByteBuffer bb, int ix, VectorMask<Byte> m) {
! return zero(species).blend(fromByteBuffer(species, bb, ix), m);
}
/**
* Returns a vector where all lane elements are set to the primitive
* value {@code e}.
*
! * @param s species of the desired vector
* @param e the value
* @return a vector of vector where all lane elements are set to
* the primitive value {@code e}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector broadcast(VectorSpecies<Byte> s, byte e) {
return VectorIntrinsics.broadcastCoerced(
! (Class<ByteVector>) s.boxType(), byte.class, s.length(),
! e, s,
((bits, sp) -> ((ByteSpecies)sp).op(i -> (byte)bits)));
}
/**
! * Returns a vector where each lane element is set to a given
! * primitive value.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
* the primitive value at index {@code N} is placed into the resulting
* vector at lane index {@code N}.
*
! * @param s species of the desired vector
* @param es the given primitive values
! * @return a vector where each lane element is set to a given primitive
! * value
! * @throws IndexOutOfBoundsException if {@code es.length < this.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector scalars(VectorSpecies<Byte> s, byte... es) {
Objects.requireNonNull(es);
! int ix = VectorIntrinsics.checkIndex(0, es.length, s.length());
! return VectorIntrinsics.load((Class<ByteVector>) s.boxType(), byte.class, s.length(),
es, Unsafe.ARRAY_BYTE_BASE_OFFSET,
! es, ix, s,
(c, idx, sp) -> ((ByteSpecies)sp).op(n -> c[idx + n]));
}
/**
* Returns a vector where the first lane element is set to the primtive
* value {@code e}, all other lane elements are set to the default
* value.
*
! * @param s species of the desired vector
* @param e the value
* @return a vector where the first lane element is set to the primitive
* value {@code e}
*/
@ForceInline
! public static final ByteVector single(VectorSpecies<Byte> s, byte e) {
! return zero(s).with(0, e);
}
/**
* Returns a vector where each lane element is set to a randomly
* generated primitive value.
*
* The semantics are equivalent to calling
* (byte){@link ThreadLocalRandom#nextInt()}
*
! * @param s species of the desired vector
* @return a vector where each lane elements is set to a randomly
* generated primitive value
*/
! public static ByteVector random(VectorSpecies<Byte> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
! return ((ByteSpecies)s).op(i -> (byte) r.nextInt());
}
// Ops
@Override
public abstract ByteVector add(Vector<Byte> v);
/**
* Adds this vector to the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive addition operation
! * ({@code +}) is applied to lane elements.
*
* @param s the input scalar
* @return the result of adding this vector to the broadcast of an input
* scalar
*/
--- 330,454 ----
* {@link java.nio.Buffer buffer} for the primitive element type,
* according to the native byte order of the underlying platform, and
* the returned vector is loaded with a mask from a primitive array
* obtained from the primitive buffer.
* The following pseudocode expresses the behaviour, where
! * {@code EBuffer} is the primitive buffer type, {@code e} is the
! * primitive element type, and {@code ESpecies} is the primitive
* species for {@code e}:
* <pre>{@code
* EBuffer eb = b.duplicate().
! * order(ByteOrder.nativeOrder()).position(offset).
* asEBuffer();
! * e[] es = new e[species.length()];
* for (int n = 0; n < t.length; n++) {
* if (m.isSet(n))
* es[n] = eb.get(n);
* }
! * EVector r = EVector.fromArray(es, 0, m);
* }</pre>
*
* @param species species of desired vector
* @param bb the byte buffer
! * @param offset the offset into the byte buffer
* @param m the mask
* @return a vector loaded from a byte buffer
* @throws IndexOutOfBoundsException if the offset is {@code < 0},
* or {@code > b.limit()},
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
! * {@code offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static ByteVector fromByteBuffer(VectorSpecies<Byte> species, ByteBuffer bb, int offset, VectorMask<Byte> m) {
! return zero(species).blend(fromByteBuffer(species, bb, offset), m);
}
/**
* Returns a vector where all lane elements are set to the primitive
* value {@code e}.
*
! * @param species species of the desired vector
* @param e the value
* @return a vector of vector where all lane elements are set to
* the primitive value {@code e}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector broadcast(VectorSpecies<Byte> species, byte e) {
return VectorIntrinsics.broadcastCoerced(
! (Class<ByteVector>) species.boxType(), byte.class, species.length(),
! e, species,
((bits, sp) -> ((ByteSpecies)sp).op(i -> (byte)bits)));
}
/**
! * Returns a vector where each lane element is set to given
! * primitive values.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
* the primitive value at index {@code N} is placed into the resulting
* vector at lane index {@code N}.
*
! * @param species species of the desired vector
* @param es the given primitive values
! * @return a vector where each lane element is set to given primitive
! * values
! * @throws IndexOutOfBoundsException if {@code es.length < species.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static ByteVector scalars(VectorSpecies<Byte> species, byte... es) {
Objects.requireNonNull(es);
! int ix = VectorIntrinsics.checkIndex(0, es.length, species.length());
! return VectorIntrinsics.load((Class<ByteVector>) species.boxType(), byte.class, species.length(),
es, Unsafe.ARRAY_BYTE_BASE_OFFSET,
! es, ix, species,
(c, idx, sp) -> ((ByteSpecies)sp).op(n -> c[idx + n]));
}
/**
* Returns a vector where the first lane element is set to the primtive
* value {@code e}, all other lane elements are set to the default
* value.
*
! * @param species species of the desired vector
* @param e the value
* @return a vector where the first lane element is set to the primitive
* value {@code e}
*/
@ForceInline
! public static final ByteVector single(VectorSpecies<Byte> species, byte e) {
! return zero(species).with(0, e);
}
/**
* Returns a vector where each lane element is set to a randomly
* generated primitive value.
*
* The semantics are equivalent to calling
* (byte){@link ThreadLocalRandom#nextInt()}
*
! * @param species species of the desired vector
* @return a vector where each lane elements is set to a randomly
* generated primitive value
*/
! public static ByteVector random(VectorSpecies<Byte> species) {
ThreadLocalRandom r = ThreadLocalRandom.current();
! return ((ByteSpecies)species).op(i -> (byte) r.nextInt());
}
// Ops
@Override
public abstract ByteVector add(Vector<Byte> v);
/**
* Adds this vector to the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive addition operation
! * ({@code +}) to each lane.
*
* @param s the input scalar
* @return the result of adding this vector to the broadcast of an input
* scalar
*/
*** 462,473 ****
/**
* Adds this vector to broadcast of an input scalar,
* selecting lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive addition operation
! * ({@code +}) is applied to lane elements.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of adding this vector to the broadcast of an input
* scalar
--- 459,470 ----
/**
* Adds this vector to broadcast of an input scalar,
* selecting lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive addition operation
! * ({@code +}) to each lane.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of adding this vector to the broadcast of an input
* scalar
*** 478,489 ****
public abstract ByteVector sub(Vector<Byte> v);
/**
* Subtracts the broadcast of an input scalar from this vector.
* <p>
! * This is a vector binary operation where the primitive subtraction
! * operation ({@code -}) is applied to lane elements.
*
* @param s the input scalar
* @return the result of subtracting the broadcast of an input
* scalar from this vector
*/
--- 475,486 ----
public abstract ByteVector sub(Vector<Byte> v);
/**
* Subtracts the broadcast of an input scalar from this vector.
* <p>
! * This is a lane-wise binary operation which applies the primitive subtraction
! * operation ({@code -}) to each lane.
*
* @param s the input scalar
* @return the result of subtracting the broadcast of an input
* scalar from this vector
*/
*** 494,505 ****
/**
* Subtracts the broadcast of an input scalar from this vector, selecting
* lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive subtraction
! * operation ({@code -}) is applied to lane elements.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of subtracting the broadcast of an input
* scalar from this vector
--- 491,502 ----
/**
* Subtracts the broadcast of an input scalar from this vector, selecting
* lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive subtraction
! * operation ({@code -}) to each lane.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of subtracting the broadcast of an input
* scalar from this vector
*** 510,521 ****
public abstract ByteVector mul(Vector<Byte> v);
/**
* Multiplies this vector with the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive multiplication
! * operation ({@code *}) is applied to lane elements.
*
* @param s the input scalar
* @return the result of multiplying this vector with the broadcast of an
* input scalar
*/
--- 507,518 ----
public abstract ByteVector mul(Vector<Byte> v);
/**
* Multiplies this vector with the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive multiplication
! * operation ({@code *}) to each lane.
*
* @param s the input scalar
* @return the result of multiplying this vector with the broadcast of an
* input scalar
*/
*** 526,537 ****
/**
* Multiplies this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive multiplication
! * operation ({@code *}) is applied to lane elements.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of multiplying this vector with the broadcast of an
* input scalar
--- 523,534 ----
/**
* Multiplies this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive multiplication
! * operation ({@code *}) to each lane.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of multiplying this vector with the broadcast of an
* input scalar
*** 557,568 ****
public abstract ByteVector min(Vector<Byte> v, VectorMask<Byte> m);
/**
* Returns the minimum of this vector and the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the operation
! * {@code (a, b) -> Math.min(a, b)} is applied to lane elements.
*
* @param s the input scalar
* @return the minimum of this vector and the broadcast of an input scalar
*/
public abstract ByteVector min(byte s);
--- 554,565 ----
public abstract ByteVector min(Vector<Byte> v, VectorMask<Byte> m);
/**
* Returns the minimum of this vector and the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the operation
! * {@code (a, b) -> Math.min(a, b)} to each lane.
*
* @param s the input scalar
* @return the minimum of this vector and the broadcast of an input scalar
*/
public abstract ByteVector min(byte s);
*** 574,585 ****
public abstract ByteVector max(Vector<Byte> v, VectorMask<Byte> m);
/**
* Returns the maximum of this vector and the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the operation
! * {@code (a, b) -> Math.max(a, b)} is applied to lane elements.
*
* @param s the input scalar
* @return the maximum of this vector and the broadcast of an input scalar
*/
public abstract ByteVector max(byte s);
--- 571,582 ----
public abstract ByteVector max(Vector<Byte> v, VectorMask<Byte> m);
/**
* Returns the maximum of this vector and the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the operation
! * {@code (a, b) -> Math.max(a, b)} to each lane.
*
* @param s the input scalar
* @return the maximum of this vector and the broadcast of an input scalar
*/
public abstract ByteVector max(byte s);
*** 588,599 ****
public abstract VectorMask<Byte> equal(Vector<Byte> v);
/**
* Tests if this vector is equal to the broadcast of an input scalar.
* <p>
! * This is a vector binary test operation where the primitive equals
! * operation ({@code ==}) is applied to lane elements.
*
* @param s the input scalar
* @return the result mask of testing if this vector is equal to the
* broadcast of an input scalar
*/
--- 585,596 ----
public abstract VectorMask<Byte> equal(Vector<Byte> v);
/**
* Tests if this vector is equal to the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary test operation which applies the primitive equals
! * operation ({@code ==}) each lane.
*
* @param s the input scalar
* @return the result mask of testing if this vector is equal to the
* broadcast of an input scalar
*/
*** 603,614 ****
public abstract VectorMask<Byte> notEqual(Vector<Byte> v);
/**
* Tests if this vector is not equal to the broadcast of an input scalar.
* <p>
! * This is a vector binary test operation where the primitive not equals
! * operation ({@code !=}) is applied to lane elements.
*
* @param s the input scalar
* @return the result mask of testing if this vector is not equal to the
* broadcast of an input scalar
*/
--- 600,611 ----
public abstract VectorMask<Byte> notEqual(Vector<Byte> v);
/**
* Tests if this vector is not equal to the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary test operation which applies the primitive not equals
! * operation ({@code !=}) to each lane.
*
* @param s the input scalar
* @return the result mask of testing if this vector is not equal to the
* broadcast of an input scalar
*/
*** 618,629 ****
public abstract VectorMask<Byte> lessThan(Vector<Byte> v);
/**
* Tests if this vector is less than the broadcast of an input scalar.
* <p>
! * This is a vector binary test operation where the primitive less than
! * operation ({@code <}) is applied to lane elements.
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than the
* broadcast of an input scalar
*/
--- 615,626 ----
public abstract VectorMask<Byte> lessThan(Vector<Byte> v);
/**
* Tests if this vector is less than the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary test operation which applies the primitive less than
! * operation ({@code <}) to each lane.
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than the
* broadcast of an input scalar
*/
*** 633,644 ****
public abstract VectorMask<Byte> lessThanEq(Vector<Byte> v);
/**
* Tests if this vector is less or equal to the broadcast of an input scalar.
* <p>
! * This is a vector binary test operation where the primitive less than
! * or equal to operation ({@code <=}) is applied to lane elements.
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than or equal
* to the broadcast of an input scalar
*/
--- 630,641 ----
public abstract VectorMask<Byte> lessThanEq(Vector<Byte> v);
/**
* Tests if this vector is less or equal to the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary test operation which applies the primitive less than
! * or equal to operation ({@code <=}) to each lane.
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than or equal
* to the broadcast of an input scalar
*/
*** 648,659 ****
public abstract VectorMask<Byte> greaterThan(Vector<Byte> v);
/**
* Tests if this vector is greater than the broadcast of an input scalar.
* <p>
! * This is a vector binary test operation where the primitive greater than
! * operation ({@code >}) is applied to lane elements.
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than the
* broadcast of an input scalar
*/
--- 645,656 ----
public abstract VectorMask<Byte> greaterThan(Vector<Byte> v);
/**
* Tests if this vector is greater than the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary test operation which applies the primitive greater than
! * operation ({@code >}) to each lane.
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than the
* broadcast of an input scalar
*/
*** 664,675 ****
/**
* Tests if this vector is greater than or equal to the broadcast of an
* input scalar.
* <p>
! * This is a vector binary test operation where the primitive greater than
! * or equal to operation ({@code >=}) is applied to lane elements.
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than or
* equal to the broadcast of an input scalar
*/
--- 661,672 ----
/**
* Tests if this vector is greater than or equal to the broadcast of an
* input scalar.
* <p>
! * This is a lane-wise binary test operation which applies the primitive greater than
! * or equal to operation ({@code >=}) to each lane.
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than or
* equal to the broadcast of an input scalar
*/
*** 720,742 ****
/**
* Bitwise ANDs this vector with an input vector.
* <p>
! * This is a vector binary operation where the primitive bitwise AND
! * operation ({@code &}) is applied to lane elements.
*
* @param v the input vector
* @return the bitwise AND of this vector with the input vector
*/
public abstract ByteVector and(Vector<Byte> v);
/**
* Bitwise ANDs this vector with the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive bitwise AND
! * operation ({@code &}) is applied to lane elements.
*
* @param s the input scalar
* @return the bitwise AND of this vector with the broadcast of an input
* scalar
*/
--- 717,739 ----
/**
* Bitwise ANDs this vector with an input vector.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise AND
! * operation ({@code &}) to each lane.
*
* @param v the input vector
* @return the bitwise AND of this vector with the input vector
*/
public abstract ByteVector and(Vector<Byte> v);
/**
* Bitwise ANDs this vector with the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise AND
! * operation ({@code &}) to each lane.
*
* @param s the input scalar
* @return the bitwise AND of this vector with the broadcast of an input
* scalar
*/
*** 744,755 ****
/**
* Bitwise ANDs this vector with an input vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive bitwise AND
! * operation ({@code &}) is applied to lane elements.
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the input vector
*/
--- 741,752 ----
/**
* Bitwise ANDs this vector with an input vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise AND
! * operation ({@code &}) to each lane.
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the input vector
*/
*** 757,768 ****
/**
* Bitwise ANDs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive bitwise AND
! * operation ({@code &}) is applied to lane elements.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the broadcast of an input
* scalar
--- 754,765 ----
/**
* Bitwise ANDs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise AND
! * operation ({@code &}) to each lane.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the broadcast of an input
* scalar
*** 770,792 ****
public abstract ByteVector and(byte s, VectorMask<Byte> m);
/**
* Bitwise ORs this vector with an input vector.
* <p>
! * This is a vector binary operation where the primitive bitwise OR
! * operation ({@code |}) is applied to lane elements.
*
* @param v the input vector
* @return the bitwise OR of this vector with the input vector
*/
public abstract ByteVector or(Vector<Byte> v);
/**
* Bitwise ORs this vector with the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive bitwise OR
! * operation ({@code |}) is applied to lane elements.
*
* @param s the input scalar
* @return the bitwise OR of this vector with the broadcast of an input
* scalar
*/
--- 767,789 ----
public abstract ByteVector and(byte s, VectorMask<Byte> m);
/**
* Bitwise ORs this vector with an input vector.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise OR
! * operation ({@code |}) to each lane.
*
* @param v the input vector
* @return the bitwise OR of this vector with the input vector
*/
public abstract ByteVector or(Vector<Byte> v);
/**
* Bitwise ORs this vector with the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise OR
! * operation ({@code |}) to each lane.
*
* @param s the input scalar
* @return the bitwise OR of this vector with the broadcast of an input
* scalar
*/
*** 794,805 ****
/**
* Bitwise ORs this vector with an input vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive bitwise OR
! * operation ({@code |}) is applied to lane elements.
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the input vector
*/
--- 791,802 ----
/**
* Bitwise ORs this vector with an input vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise OR
! * operation ({@code |}) to each lane.
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the input vector
*/
*** 807,818 ****
/**
* Bitwise ORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive bitwise OR
! * operation ({@code |}) is applied to lane elements.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the broadcast of an input
* scalar
--- 804,815 ----
/**
* Bitwise ORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise OR
! * operation ({@code |}) to each lane.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the broadcast of an input
* scalar
*** 820,842 ****
public abstract ByteVector or(byte s, VectorMask<Byte> m);
/**
* Bitwise XORs this vector with an input vector.
* <p>
! * This is a vector binary operation where the primitive bitwise XOR
! * operation ({@code ^}) is applied to lane elements.
*
* @param v the input vector
* @return the bitwise XOR of this vector with the input vector
*/
public abstract ByteVector xor(Vector<Byte> v);
/**
* Bitwise XORs this vector with the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive bitwise XOR
! * operation ({@code ^}) is applied to lane elements.
*
* @param s the input scalar
* @return the bitwise XOR of this vector with the broadcast of an input
* scalar
*/
--- 817,839 ----
public abstract ByteVector or(byte s, VectorMask<Byte> m);
/**
* Bitwise XORs this vector with an input vector.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise XOR
! * operation ({@code ^}) to each lane.
*
* @param v the input vector
* @return the bitwise XOR of this vector with the input vector
*/
public abstract ByteVector xor(Vector<Byte> v);
/**
* Bitwise XORs this vector with the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise XOR
! * operation ({@code ^}) to each lane.
*
* @param s the input scalar
* @return the bitwise XOR of this vector with the broadcast of an input
* scalar
*/
*** 844,855 ****
/**
* Bitwise XORs this vector with an input vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive bitwise XOR
! * operation ({@code ^}) is applied to lane elements.
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the input vector
*/
--- 841,852 ----
/**
* Bitwise XORs this vector with an input vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise XOR
! * operation ({@code ^}) to each lane.
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the input vector
*/
*** 857,868 ****
/**
* Bitwise XORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive bitwise XOR
! * operation ({@code ^}) is applied to lane elements.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the broadcast of an input
* scalar
--- 854,865 ----
/**
* Bitwise XORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive bitwise XOR
! * operation ({@code ^}) to each lane.
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the broadcast of an input
* scalar
*** 870,902 ****
public abstract ByteVector xor(byte s, VectorMask<Byte> m);
/**
* Bitwise NOTs this vector.
* <p>
! * This is a vector unary operation where the primitive bitwise NOT
! * operation ({@code ~}) is applied to lane elements.
*
* @return the bitwise NOT of this vector
*/
public abstract ByteVector not();
/**
* Bitwise NOTs this vector, selecting lane elements controlled by a mask.
* <p>
! * This is a vector unary operation where the primitive bitwise NOT
! * operation ({@code ~}) is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the bitwise NOT of this vector
*/
public abstract ByteVector not(VectorMask<Byte> m);
/**
* Logically left shifts this vector by the broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive logical left shift
! * operation ({@code <<}) is applied to lane elements to left shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
--- 867,899 ----
public abstract ByteVector xor(byte s, VectorMask<Byte> m);
/**
* Bitwise NOTs this vector.
* <p>
! * This is a lane-wise unary operation which applies the primitive bitwise NOT
! * operation ({@code ~}) to each lane.
*
* @return the bitwise NOT of this vector
*/
public abstract ByteVector not();
/**
* Bitwise NOTs this vector, selecting lane elements controlled by a mask.
* <p>
! * This is a lane-wise unary operation which applies the primitive bitwise NOT
! * operation ({@code ~}) to each lane.
*
* @param m the mask controlling lane selection
* @return the bitwise NOT of this vector
*/
public abstract ByteVector not(VectorMask<Byte> m);
/**
* Logically left shifts this vector by the broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive logical left shift
! * operation ({@code <<}) to each lane to left shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
*** 908,919 ****
/**
* Logically left shifts this vector by the broadcast of an input scalar,
* selecting lane elements controlled by a mask.
* <p>
! * This is a vector binary operation where the primitive logical left shift
! * operation ({@code <<}) is applied to lane elements to left shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
--- 905,916 ----
/**
* Logically left shifts this vector by the broadcast of an input scalar,
* selecting lane elements controlled by a mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive logical left shift
! * operation ({@code <<}) to each lane to left shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
*** 929,940 ****
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive logical right shift
! * operation ({@code >>>}) is applied to lane elements to logically right shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
--- 926,937 ----
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive logical right shift
! * operation ({@code >>>}) to each lane to logically right shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
*** 947,958 ****
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar, selecting lane elements controlled by a
* mask.
* <p>
! * This is a vector binary operation where the primitive logical right shift
! * operation ({@code >>>}) is applied to lane elements to logically right shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
--- 944,955 ----
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar, selecting lane elements controlled by a
* mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive logical right shift
! * operation ({@code >>}) to each lane to logically right shift the
* element by shift value as specified by the input scalar. Only the 3
* lowest-order bits of shift value are used. It is as if the shift value
* were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
*** 966,977 ****
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar.
* <p>
! * This is a vector binary operation where the primitive arithmetic right
! * shift operation ({@code >>}) is applied to lane elements to arithmetically
* right shift the element by shift value as specified by the input scalar.
* Only the 3 lowest-order bits of shift value are used. It is as if the shift
* value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
--- 963,974 ----
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar.
* <p>
! * This is a lane-wise binary operation which applies the primitive arithmetic right
! * shift operation ({@code >>}) to each lane to arithmetically
* right shift the element by shift value as specified by the input scalar.
* Only the 3 lowest-order bits of shift value are used. It is as if the shift
* value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
*** 984,995 ****
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar, selecting lane elements controlled by a
* mask.
* <p>
! * This is a vector binary operation where the primitive arithmetic right
! * shift operation ({@code >>}) is applied to lane elements to arithmetically
* right shift the element by shift value as specified by the input scalar.
* Only the 3 lowest-order bits of shift value are used. It is as if the shift
* value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
--- 981,992 ----
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar, selecting lane elements controlled by a
* mask.
* <p>
! * This is a lane-wise binary operation which applies the primitive arithmetic right
! * shift operation ({@code >>}) to each lane to arithmetically
* right shift the element by shift value as specified by the input scalar.
* Only the 3 lowest-order bits of shift value are used. It is as if the shift
* value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
* The shift distance actually used is therefore always in the range 0 to 7, inclusive.
*
*** 1016,1075 ****
// Type specific horizontal reductions
/**
* Adds all lane elements of this vector.
* <p>
! * This is an associative vector reduction operation where the addition
! * operation ({@code +}) is applied to lane elements,
* and the identity value is {@code 0}.
*
* @return the addition of all the lane elements of this vector
*/
public abstract byte addAll();
/**
* Adds all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the addition
! * operation ({@code +}) is applied to lane elements,
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the addition of the selected lane elements of this vector
*/
public abstract byte addAll(VectorMask<Byte> m);
/**
* Multiplies all lane elements of this vector.
* <p>
! * This is an associative vector reduction operation where the
! * multiplication operation ({@code *}) is applied to lane elements,
* and the identity value is {@code 1}.
*
* @return the multiplication of all the lane elements of this vector
*/
public abstract byte mulAll();
/**
* Multiplies all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the
! * multiplication operation ({@code *}) is applied to lane elements,
* and the identity value is {@code 1}.
*
* @param m the mask controlling lane selection
* @return the multiplication of all the lane elements of this vector
*/
public abstract byte mulAll(VectorMask<Byte> m);
/**
* Returns the minimum lane element of this vector.
* <p>
! * This is an associative vector reduction operation where the operation
! * {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
* and the identity value is
* {@link Byte#MAX_VALUE}.
*
* @return the minimum lane element of this vector
*/
--- 1013,1072 ----
// Type specific horizontal reductions
/**
* Adds all lane elements of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the addition
! * operation ({@code +}) to lane elements,
* and the identity value is {@code 0}.
*
* @return the addition of all the lane elements of this vector
*/
public abstract byte addAll();
/**
* Adds all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the addition
! * operation ({@code +}) to lane elements,
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the addition of the selected lane elements of this vector
*/
public abstract byte addAll(VectorMask<Byte> m);
/**
* Multiplies all lane elements of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the
! * multiplication operation ({@code *}) to lane elements,
* and the identity value is {@code 1}.
*
* @return the multiplication of all the lane elements of this vector
*/
public abstract byte mulAll();
/**
* Multiplies all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the
! * multiplication operation ({@code *}) to lane elements,
* and the identity value is {@code 1}.
*
* @param m the mask controlling lane selection
* @return the multiplication of all the lane elements of this vector
*/
public abstract byte mulAll(VectorMask<Byte> m);
/**
* Returns the minimum lane element of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the operation
! * {@code (a, b) -> Math.min(a, b)} to lane elements,
* and the identity value is
* {@link Byte#MAX_VALUE}.
*
* @return the minimum lane element of this vector
*/
*** 1077,1088 ****
/**
* Returns the minimum lane element of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the operation
! * {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
* and the identity value is
* {@link Byte#MAX_VALUE}.
*
* @param m the mask controlling lane selection
* @return the minimum lane element of this vector
--- 1074,1085 ----
/**
* Returns the minimum lane element of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the operation
! * {@code (a, b) -> Math.min(a, b)} to lane elements,
* and the identity value is
* {@link Byte#MAX_VALUE}.
*
* @param m the mask controlling lane selection
* @return the minimum lane element of this vector
*** 1090,1101 ****
public abstract byte minAll(VectorMask<Byte> m);
/**
* Returns the maximum lane element of this vector.
* <p>
! * This is an associative vector reduction operation where the operation
! * {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
* and the identity value is
* {@link Byte#MIN_VALUE}.
*
* @return the maximum lane element of this vector
*/
--- 1087,1098 ----
public abstract byte minAll(VectorMask<Byte> m);
/**
* Returns the maximum lane element of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the operation
! * {@code (a, b) -> Math.max(a, b)} to lane elements,
* and the identity value is
* {@link Byte#MIN_VALUE}.
*
* @return the maximum lane element of this vector
*/
*** 1103,1114 ****
/**
* Returns the maximum lane element of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the operation
! * {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
* and the identity value is
* {@link Byte#MIN_VALUE}.
*
* @param m the mask controlling lane selection
* @return the maximum lane element of this vector
--- 1100,1111 ----
/**
* Returns the maximum lane element of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the operation
! * {@code (a, b) -> Math.max(a, b)} to lane elements,
* and the identity value is
* {@link Byte#MIN_VALUE}.
*
* @param m the mask controlling lane selection
* @return the maximum lane element of this vector
*** 1116,1187 ****
public abstract byte maxAll(VectorMask<Byte> m);
/**
* Logically ORs all lane elements of this vector.
* <p>
! * This is an associative vector reduction operation where the logical OR
! * operation ({@code |}) is applied to lane elements,
* and the identity value is {@code 0}.
*
* @return the logical OR all the lane elements of this vector
*/
public abstract byte orAll();
/**
* Logically ORs all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the logical OR
! * operation ({@code |}) is applied to lane elements,
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical OR all the lane elements of this vector
*/
public abstract byte orAll(VectorMask<Byte> m);
/**
* Logically ANDs all lane elements of this vector.
* <p>
! * This is an associative vector reduction operation where the logical AND
! * operation ({@code |}) is applied to lane elements,
* and the identity value is {@code -1}.
*
* @return the logical AND all the lane elements of this vector
*/
public abstract byte andAll();
/**
* Logically ANDs all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the logical AND
! * operation ({@code |}) is applied to lane elements,
* and the identity value is {@code -1}.
*
* @param m the mask controlling lane selection
* @return the logical AND all the lane elements of this vector
*/
public abstract byte andAll(VectorMask<Byte> m);
/**
* Logically XORs all lane elements of this vector.
* <p>
! * This is an associative vector reduction operation where the logical XOR
! * operation ({@code ^}) is applied to lane elements,
* and the identity value is {@code 0}.
*
* @return the logical XOR all the lane elements of this vector
*/
public abstract byte xorAll();
/**
* Logically XORs all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative vector reduction operation where the logical XOR
! * operation ({@code ^}) is applied to lane elements,
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical XOR all the lane elements of this vector
*/
--- 1113,1184 ----
public abstract byte maxAll(VectorMask<Byte> m);
/**
* Logically ORs all lane elements of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the logical OR
! * operation ({@code |}) to lane elements,
* and the identity value is {@code 0}.
*
* @return the logical OR all the lane elements of this vector
*/
public abstract byte orAll();
/**
* Logically ORs all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the logical OR
! * operation ({@code |}) to lane elements,
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical OR all the lane elements of this vector
*/
public abstract byte orAll(VectorMask<Byte> m);
/**
* Logically ANDs all lane elements of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the logical AND
! * operation ({@code |}) to lane elements,
* and the identity value is {@code -1}.
*
* @return the logical AND all the lane elements of this vector
*/
public abstract byte andAll();
/**
* Logically ANDs all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the logical AND
! * operation ({@code |}) to lane elements,
* and the identity value is {@code -1}.
*
* @param m the mask controlling lane selection
* @return the logical AND all the lane elements of this vector
*/
public abstract byte andAll(VectorMask<Byte> m);
/**
* Logically XORs all lane elements of this vector.
* <p>
! * This is an associative cross-lane reduction operation which applies the logical XOR
! * operation ({@code ^}) to lane elements,
* and the identity value is {@code 0}.
*
* @return the logical XOR all the lane elements of this vector
*/
public abstract byte xorAll();
/**
* Logically XORs all lane elements of this vector, selecting lane elements
* controlled by a mask.
* <p>
! * This is an associative cross-lane reduction operation which applies the logical XOR
! * operation ({@code ^}) to lane elements,
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical XOR all the lane elements of this vector
*/
*** 1195,1205 ****
* @param i the lane index
* @return the lane element at lane index {@code i}
* @throws IllegalArgumentException if the index is is out of range
* ({@code < 0 || >= length()})
*/
! public abstract byte get(int i);
/**
* Replaces the lane element of this vector at lane index {@code i} with
* value {@code e}.
* <p>
--- 1192,1202 ----
* @param i the lane index
* @return the lane element at lane index {@code i}
* @throws IllegalArgumentException if the index is is out of range
* ({@code < 0 || >= length()})
*/
! public abstract byte lane(int i);
/**
* Replaces the lane element of this vector at lane index {@code i} with
* value {@code e}.
* <p>
*** 1242,1323 ****
/**
* Stores this vector into an array starting at offset.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* the lane element at index {@code N} is stored into the array at index
! * {@code i + N}.
*
* @param a the array
! * @param i the offset into the array
! * @throws IndexOutOfBoundsException if {@code i < 0}, or
! * {@code i > a.length - this.length()}
*/
! public abstract void intoArray(byte[] a, int i);
/**
* Stores this vector into an array starting at offset and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the lane element at
! * index {@code N} is stored into the array index {@code i + N}.
*
* @param a the array
! * @param i the offset into the array
* @param m the mask
! * @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
! * is set {@code i >= a.length - N}
*/
! public abstract void intoArray(byte[] a, int i, VectorMask<Byte> m);
/**
* Stores this vector into an array using indexes obtained from an index
* map.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
* lane element at index {@code N} is stored into the array at index
! * {@code i + indexMap[j + N]}.
*
* @param a the array
! * @param i the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param indexMap the index map
! * @param j the offset into the index map
! * @throws IndexOutOfBoundsException if {@code j < 0}, or
! * {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} the result of
! * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
*/
! public void intoArray(byte[] a, int i, int[] indexMap, int j) {
! forEach((n, e) -> a[i + indexMap[j + n]] = e);
}
/**
* Stores this vector into an array using indexes obtained from an index
* map and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the lane element at
* index {@code N} is stored into the array at index
! * {@code i + indexMap[j + N]}.
*
* @param a the array
! * @param i the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param m the mask
* @param indexMap the index map
! * @param j the offset into the index map
* @throws IndexOutOfBoundsException if {@code j < 0}, or
! * {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} where the mask at lane
! * {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
! public void intoArray(byte[] a, int i, VectorMask<Byte> m, int[] indexMap, int j) {
! forEach(m, (n, e) -> a[i + indexMap[j + n]] = e);
}
// Species
@Override
public abstract VectorSpecies<Byte> species();
--- 1239,1320 ----
/**
* Stores this vector into an array starting at offset.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* the lane element at index {@code N} is stored into the array at index
! * {@code offset + N}.
*
* @param a the array
! * @param offset the offset into the array
! * @throws IndexOutOfBoundsException if {@code offset < 0}, or
! * {@code offset > a.length - this.length()}
*/
! public abstract void intoArray(byte[] a, int offset);
/**
* Stores this vector into an array starting at offset and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the lane element at
! * index {@code N} is stored into the array index {@code offset + N}.
*
* @param a the array
! * @param offset the offset into the array
* @param m the mask
! * @throws IndexOutOfBoundsException if {@code offset < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
! * is set {@code offset >= a.length - N}
*/
! public abstract void intoArray(byte[] a, int offset, VectorMask<Byte> m);
/**
* Stores this vector into an array using indexes obtained from an index
* map.
* <p>
* For each vector lane, where {@code N} is the vector lane index, the
* lane element at index {@code N} is stored into the array at index
! * {@code a_offset + indexMap[i_offset + N]}.
*
* @param a the array
! * @param a_offset the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param indexMap the index map
! * @param i_offset the offset into the index map
! * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
! * {@code i_offset > indexMap.length - this.length()},
* or for any vector lane index {@code N} the result of
! * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length}
*/
! public void intoArray(byte[] a, int a_offset, int[] indexMap, int i_offset) {
! forEach((n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
}
/**
* Stores this vector into an array using indexes obtained from an index
* map and using a mask.
* <p>
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the lane element at
* index {@code N} is stored into the array at index
! * {@code a_offset + indexMap[i_offset + N]}.
*
* @param a the array
! * @param a_offset the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param m the mask
* @param indexMap the index map
! * @param i_offset the offset into the index map
* @throws IndexOutOfBoundsException if {@code j < 0}, or
! * {@code i_offset > indexMap.length - this.length()},
* or for any vector lane index {@code N} where the mask at lane
! * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is
* {@code < 0} or {@code >= a.length}
*/
! public void intoArray(byte[] a, int a_offset, VectorMask<Byte> m, int[] indexMap, int i_offset) {
! forEach(m, (n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
}
// Species
@Override
public abstract VectorSpecies<Byte> species();
< prev index next >