104 */
105 public abstract class VectorMask<E> {
106 VectorMask() {}
107
108 /**
109 * Returns the species of this mask.
110 *
111 * @return the species of this mask
112 */
113 public abstract VectorSpecies<E> species();
114
115 /**
116 * Returns the number of mask lanes (the length).
117 *
118 * @return the number of mask lanes
119 */
120 public int length() { return species().length(); }
121
122 /**
123 * Returns a mask where each lane is set or unset according to given
124 * {@code boolean} values
125 * <p>
126 * For each mask lane, where {@code N} is the mask lane index,
127 * if the given {@code boolean} value at index {@code N} is {@code true}
128 * then the mask lane at index {@code N} is set, otherwise it is unset.
129 *
130 * @param species mask species
131 * @param bits the given {@code boolean} values
132 * @return a mask where each lane is set or unset according to the given {@code boolean} value
133 * @throws IndexOutOfBoundsException if {@code bits.length < species.length()}
134 */
135 @ForceInline
136 public static <E> VectorMask<E> fromValues(VectorSpecies<E> species, boolean... bits) {
137 return fromArray(species, bits, 0);
138 }
139
140 /**
141 * Loads a mask from a {@code boolean} array starting at an offset.
142 * <p>
143 * For each mask lane, where {@code N} is the mask lane index,
144 * if the array element at index {@code ix + N} is {@code true} then the
|
104 */
105 public abstract class VectorMask<E> {
106 VectorMask() {}
107
108 /**
109 * Returns the species of this mask.
110 *
111 * @return the species of this mask
112 */
113 public abstract VectorSpecies<E> species();
114
115 /**
116 * Returns the number of mask lanes (the length).
117 *
118 * @return the number of mask lanes
119 */
120 public int length() { return species().length(); }
121
122 /**
123 * Returns a mask where each lane is set or unset according to given
124 * {@code boolean} values.
125 * <p>
126 * For each mask lane, where {@code N} is the mask lane index,
127 * if the given {@code boolean} value at index {@code N} is {@code true}
128 * then the mask lane at index {@code N} is set, otherwise it is unset.
129 *
130 * @param species mask species
131 * @param bits the given {@code boolean} values
132 * @return a mask where each lane is set or unset according to the given {@code boolean} value
133 * @throws IndexOutOfBoundsException if {@code bits.length < species.length()}
134 */
135 @ForceInline
136 public static <E> VectorMask<E> fromValues(VectorSpecies<E> species, boolean... bits) {
137 return fromArray(species, bits, 0);
138 }
139
140 /**
141 * Loads a mask from a {@code boolean} array starting at an offset.
142 * <p>
143 * For each mask lane, where {@code N} is the mask lane index,
144 * if the array element at index {@code ix + N} is {@code true} then the
|