Skip to content

Commit 1fc7923

Browse files
update
1 parent 16d621c commit 1fc7923

1 file changed

Lines changed: 13 additions & 34 deletions

File tree

test/jdk/jdk/incubator/vector/AbstractVectorTest.java

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ static int[] fillInts(int[] a, IntOp f) {
117117
}
118118
return a;
119119
}),
120+
withToString("mask[i % 5]", (int l) -> {
121+
boolean[] a = new boolean[l];
122+
for (int i = 0; i < l; i++) {
123+
a[i] = (i % 2 == 0);
124+
}
125+
return a;
126+
}),
120127
withToString("mask[true]", (int l) -> {
121128
boolean[] a = new boolean[l];
122129
Arrays.fill(a, true);
@@ -151,40 +158,12 @@ static long[] pack_booleans_to_longs(boolean[] mask) {
151158
return packed;
152159
}
153160

154-
static final List<IntFunction<long[]>> LONG_MASK_GENERATORS = List.of(
155-
withToString("mask[random]", (int l) -> {
156-
boolean[] a = new boolean[l];
157-
for (int i = 0; i < l; i++) {
158-
a[i] = RAND.nextBoolean();
159-
}
160-
return pack_booleans_to_longs(a);
161-
}),
162-
withToString("mask[i % 2]", (int l) -> {
163-
boolean[] a = new boolean[l];
164-
for (int i = 0; i < l; i++) {
165-
a[i] = (i % 2 == 0);
166-
}
167-
return pack_booleans_to_longs(a);
168-
}),
169-
withToString("mask[i % 5]", (int l) -> {
170-
boolean[] a = new boolean[l];
171-
for (int i = 0; i < l; i++) {
172-
a[i] = (i % 2 == 0);
173-
}
174-
return pack_booleans_to_longs(a);
175-
}),
176-
withToString("mask[true]", (int l) -> {
177-
boolean[] a = new boolean[l];
178-
Arrays.fill(a, true);
179-
return pack_booleans_to_longs(a);
180-
}),
181-
withToString("mask[false]", (int l) ->
182-
pack_booleans_to_longs(new boolean[l])),
183-
withToString("mask[0xFFFFFFFFFFFFFFFFL]", (_l) -> new long[] { 0xFFFFFFFFFFFFFFFFL }),
184-
withToString("mask[0x0000000000000000L]", (_l) -> new long[] { 0x0000000000000000L }),
185-
withToString("mask[0x5555555555555555L]", (_l) -> new long[] { 0x5555555555555555L }),
186-
withToString("mask[0x0123456789abcdefL]", (_l) -> new long[] { 0x0123456789abcdefL })
187-
);
161+
static final List<IntFunction<long[]>> LONG_MASK_GENERATORS = BOOLEAN_MASK_GENERATORS.stream()
162+
.map(f -> withToString(
163+
f.toString().replace("mask", "long_mask"),
164+
(IntFunction<long[]>) (int l) -> pack_booleans_to_longs(f.apply(l))
165+
))
166+
.collect(Collectors.toList());
188167

189168
static final List<BiFunction<Integer,Integer,int[]>> INT_SHUFFLE_GENERATORS = List.of(
190169
withToStringBi("shuffle[random]",

0 commit comments

Comments
 (0)