41
42 // -- This file was mechanically generated: Do not edit! -- //
43
44 @SuppressWarnings("cast") // warning: redundant cast
45 final class ShortMaxVector extends ShortVector {
46 static final ShortSpecies VSPECIES =
47 (ShortSpecies) ShortVector.SPECIES_MAX;
48
49 static final VectorShape VSHAPE =
50 VSPECIES.vectorShape();
51
52 static final Class<ShortMaxVector> VCLASS = ShortMaxVector.class;
53
54 static final int VSIZE = VSPECIES.vectorBitSize();
55
56 static final int VLENGTH = VSPECIES.laneCount();
57
58 static final Class<Short> ETYPE = short.class;
59
60 // The JVM expects to find the state here.
61 private final short[] vec; // Don't access directly, use getElements() instead.
62
63 ShortMaxVector(short[] v) {
64 vec = v;
65 }
66
67 // For compatibility as ShortMaxVector::new,
68 // stored into species.vectorFactory.
69 ShortMaxVector(Object v) {
70 this((short[]) v);
71 }
72
73 static final ShortMaxVector ZERO = new ShortMaxVector(new short[VLENGTH]);
74 static final ShortMaxVector IOTA = new ShortMaxVector(VSPECIES.iotaArray());
75
76 static {
77 // Warm up a few species caches.
78 // If we do this too much we will
79 // get NPEs from bootstrap circularity.
80 VSPECIES.dummyVector();
81 VSPECIES.withLanes(LaneType.BYTE);
102
103 @ForceInline
104 @Override
105 public final VectorShape shape() { return VSHAPE; }
106
107 @ForceInline
108 @Override
109 public final int length() { return VLENGTH; }
110
111 @ForceInline
112 @Override
113 public final int bitSize() { return VSIZE; }
114
115 @ForceInline
116 @Override
117 public final int byteSize() { return VSIZE / Byte.SIZE; }
118
119 /*package-private*/
120 @ForceInline
121 final @Override
122 short[] getElements() {
123 return VectorIntrinsics.maybeRebox(this).vec;
124 }
125
126 // Virtualized constructors
127
128 @Override
129 @ForceInline
130 public final ShortMaxVector broadcast(short e) {
131 return (ShortMaxVector) super.broadcastTemplate(e); // specialize
132 }
133
134 @Override
135 @ForceInline
136 public final ShortMaxVector broadcast(long e) {
137 return (ShortMaxVector) super.broadcastTemplate(e); // specialize
138 }
139
140 @Override
141 @ForceInline
142 ShortMaxMask maskFromArray(boolean[] bits) {
461
462 @Override
463 @ForceInline
464 public ShortMaxVector selectFrom(Vector<Short> v,
465 VectorMask<Short> m) {
466 return (ShortMaxVector)
467 super.selectFromTemplate((ShortMaxVector) v,
468 (ShortMaxMask) m); // specialize
469 }
470
471
472 @Override
473 public short lane(int i) {
474 if (i < 0 || i >= VLENGTH) {
475 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
476 }
477 return (short) VectorIntrinsics.extract(
478 VCLASS, ETYPE, VLENGTH,
479 this, i,
480 (vec, ix) -> {
481 short[] vecarr = vec.getElements();
482 return (long)vecarr[ix];
483 });
484 }
485
486 @Override
487 public ShortMaxVector withLane(int i, short e) {
488 if (i < 0 || i >= VLENGTH) {
489 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
490 }
491 return VectorIntrinsics.insert(
492 VCLASS, ETYPE, VLENGTH,
493 this, i, (long)e,
494 (v, ix, bits) -> {
495 short[] res = v.getElements().clone();
496 res[ix] = (short)bits;
497 return v.vectorFactory(res);
498 });
499 }
500
501 // Mask
502
503 static final class ShortMaxMask extends AbstractMask<Short> {
504
505 private final boolean[] bits; // Don't access directly, use getBits() instead.
506
507 public ShortMaxMask(boolean[] bits) {
508 this(bits, 0);
509 }
510
511 public ShortMaxMask(boolean[] bits, int offset) {
512 boolean[] a = new boolean[vspecies().laneCount()];
513 for (int i = 0; i < a.length; i++) {
514 a[i] = bits[offset + i];
515 }
|
41
42 // -- This file was mechanically generated: Do not edit! -- //
43
44 @SuppressWarnings("cast") // warning: redundant cast
45 final class ShortMaxVector extends ShortVector {
46 static final ShortSpecies VSPECIES =
47 (ShortSpecies) ShortVector.SPECIES_MAX;
48
49 static final VectorShape VSHAPE =
50 VSPECIES.vectorShape();
51
52 static final Class<ShortMaxVector> VCLASS = ShortMaxVector.class;
53
54 static final int VSIZE = VSPECIES.vectorBitSize();
55
56 static final int VLENGTH = VSPECIES.laneCount();
57
58 static final Class<Short> ETYPE = short.class;
59
60 // The JVM expects to find the state here.
61 private final short[] vec; // Don't access directly, use vec() instead.
62
63 ShortMaxVector(short[] v) {
64 vec = v;
65 }
66
67 // For compatibility as ShortMaxVector::new,
68 // stored into species.vectorFactory.
69 ShortMaxVector(Object v) {
70 this((short[]) v);
71 }
72
73 static final ShortMaxVector ZERO = new ShortMaxVector(new short[VLENGTH]);
74 static final ShortMaxVector IOTA = new ShortMaxVector(VSPECIES.iotaArray());
75
76 static {
77 // Warm up a few species caches.
78 // If we do this too much we will
79 // get NPEs from bootstrap circularity.
80 VSPECIES.dummyVector();
81 VSPECIES.withLanes(LaneType.BYTE);
102
103 @ForceInline
104 @Override
105 public final VectorShape shape() { return VSHAPE; }
106
107 @ForceInline
108 @Override
109 public final int length() { return VLENGTH; }
110
111 @ForceInline
112 @Override
113 public final int bitSize() { return VSIZE; }
114
115 @ForceInline
116 @Override
117 public final int byteSize() { return VSIZE / Byte.SIZE; }
118
119 /*package-private*/
120 @ForceInline
121 final @Override
122 short[] vec() {
123 return VectorIntrinsics.maybeRebox(this).vec;
124 }
125
126 // Virtualized constructors
127
128 @Override
129 @ForceInline
130 public final ShortMaxVector broadcast(short e) {
131 return (ShortMaxVector) super.broadcastTemplate(e); // specialize
132 }
133
134 @Override
135 @ForceInline
136 public final ShortMaxVector broadcast(long e) {
137 return (ShortMaxVector) super.broadcastTemplate(e); // specialize
138 }
139
140 @Override
141 @ForceInline
142 ShortMaxMask maskFromArray(boolean[] bits) {
461
462 @Override
463 @ForceInline
464 public ShortMaxVector selectFrom(Vector<Short> v,
465 VectorMask<Short> m) {
466 return (ShortMaxVector)
467 super.selectFromTemplate((ShortMaxVector) v,
468 (ShortMaxMask) m); // specialize
469 }
470
471
472 @Override
473 public short lane(int i) {
474 if (i < 0 || i >= VLENGTH) {
475 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
476 }
477 return (short) VectorIntrinsics.extract(
478 VCLASS, ETYPE, VLENGTH,
479 this, i,
480 (vec, ix) -> {
481 short[] vecarr = vec.vec();
482 return (long)vecarr[ix];
483 });
484 }
485
486 @Override
487 public ShortMaxVector withLane(int i, short e) {
488 if (i < 0 || i >= VLENGTH) {
489 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
490 }
491 return VectorIntrinsics.insert(
492 VCLASS, ETYPE, VLENGTH,
493 this, i, (long)e,
494 (v, ix, bits) -> {
495 short[] res = v.vec().clone();
496 res[ix] = (short)bits;
497 return v.vectorFactory(res);
498 });
499 }
500
501 // Mask
502
503 static final class ShortMaxMask extends AbstractMask<Short> {
504
505 private final boolean[] bits; // Don't access directly, use getBits() instead.
506
507 public ShortMaxMask(boolean[] bits) {
508 this(bits, 0);
509 }
510
511 public ShortMaxMask(boolean[] bits, int offset) {
512 boolean[] a = new boolean[vspecies().laneCount()];
513 for (int i = 0; i < a.length; i++) {
514 a[i] = bits[offset + i];
515 }
|