1290 @Override
1291 @ForceInline
1292 public $type$ minAll(Mask<$Boxtype$> m) {
1293 return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, $Boxtype$.MAX_VALUE), m).minAll();
1294 }
1295
1296 @Override
1297 @ForceInline
1298 public $type$ maxAll(Mask<$Boxtype$> m) {
1299 return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, $Boxtype$.MIN_VALUE), m).maxAll();
1300 }
1301
1302 @Override
1303 @ForceInline
1304 public Shuffle<$Boxtype$> toShuffle() {
1305 $type$[] a = toArray();
1306 int[] sa = new int[a.length];
1307 for (int i = 0; i < a.length; i++) {
1308 sa[i] = (int) a[i];
1309 }
1310 return $abstractvectortype$.shuffleFromArray(SPECIES, sa, 0);
1311 }
1312
1313 // Memory operations
1314
1315 private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_$TYPE$_INDEX_SCALE);
1316 private static final int BOOLEAN_ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
1317
1318 @Override
1319 @ForceInline
1320 public void intoArray($type$[] a, int ix) {
1321 Objects.requireNonNull(a);
1322 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
1323 VectorIntrinsics.store($vectortype$.class, $type$.class, LENGTH,
1324 a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
1325 this,
1326 a, ix,
1327 (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
1328 }
1329
1330 @Override
1835 $masktype$ m = ($masktype$)o;
1836 return VectorIntrinsics.binaryOp(VECTOR_OP_OR, $masktype$.class, $bitstype$.class, LENGTH,
1837 this, m,
1838 (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
1839 }
1840
1841 // Reductions
1842
1843 @Override
1844 @ForceInline
1845 public boolean anyTrue() {
1846 return VectorIntrinsics.test(BT_ne, $masktype$.class, $bitstype$.class, LENGTH,
1847 this, this,
1848 (m, __) -> anyTrueHelper((($masktype$)m).getBits()));
1849 }
1850
1851 @Override
1852 @ForceInline
1853 public boolean allTrue() {
1854 return VectorIntrinsics.test(BT_overflow, $masktype$.class, $bitstype$.class, LENGTH,
1855 this, $abstractvectortype$.maskAllTrue(species()),
1856 (m, __) -> allTrueHelper((($masktype$)m).getBits()));
1857 }
1858 }
1859
1860 // Shuffle
1861
1862 static final class $shuffletype$ extends AbstractShuffle<$Boxtype$> {
1863 $shuffletype$(byte[] reorder) {
1864 super(reorder);
1865 }
1866
1867 public $shuffletype$(int[] reorder) {
1868 super(reorder);
1869 }
1870
1871 public $shuffletype$(int[] reorder, int i) {
1872 super(reorder, i);
1873 }
1874
1875 public $shuffletype$(IntUnaryOperator f) {
1899 Class<?> stype = species.elementType();
1900 int [] shuffleArray = toArray();
1901 if (stype == byte.class) {
1902 return (Shuffle<F>) new Byte$bits$Vector.Byte$bits$Shuffle(shuffleArray);
1903 } else if (stype == short.class) {
1904 return (Shuffle<F>) new Short$bits$Vector.Short$bits$Shuffle(shuffleArray);
1905 } else if (stype == int.class) {
1906 return (Shuffle<F>) new Int$bits$Vector.Int$bits$Shuffle(shuffleArray);
1907 } else if (stype == long.class) {
1908 return (Shuffle<F>) new Long$bits$Vector.Long$bits$Shuffle(shuffleArray);
1909 } else if (stype == float.class) {
1910 return (Shuffle<F>) new Float$bits$Vector.Float$bits$Shuffle(shuffleArray);
1911 } else if (stype == double.class) {
1912 return (Shuffle<F>) new Double$bits$Vector.Double$bits$Shuffle(shuffleArray);
1913 } else {
1914 throw new UnsupportedOperationException("Bad lane type for casting.");
1915 }
1916 }
1917
1918 @Override
1919 public $shuffletype$ rearrange(Vector.Shuffle<$Boxtype$> o) {
1920 $shuffletype$ s = ($shuffletype$) o;
1921 byte[] r = new byte[reorder.length];
1922 for (int i = 0; i < reorder.length; i++) {
1923 r[i] = reorder[s.reorder[i]];
1924 }
1925 return new $shuffletype$(r);
1926 }
1927 }
1928
1929 // Species
1930
1931 @Override
1932 public Species<$Boxtype$> species() {
1933 return SPECIES;
1934 }
1935 }
|
1290 @Override
1291 @ForceInline
1292 public $type$ minAll(Mask<$Boxtype$> m) {
1293 return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, $Boxtype$.MAX_VALUE), m).minAll();
1294 }
1295
1296 @Override
1297 @ForceInline
1298 public $type$ maxAll(Mask<$Boxtype$> m) {
1299 return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, $Boxtype$.MIN_VALUE), m).maxAll();
1300 }
1301
1302 @Override
1303 @ForceInline
1304 public Shuffle<$Boxtype$> toShuffle() {
1305 $type$[] a = toArray();
1306 int[] sa = new int[a.length];
1307 for (int i = 0; i < a.length; i++) {
1308 sa[i] = (int) a[i];
1309 }
1310 return Shuffle.fromArray(SPECIES, sa, 0);
1311 }
1312
1313 // Memory operations
1314
1315 private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_$TYPE$_INDEX_SCALE);
1316 private static final int BOOLEAN_ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
1317
1318 @Override
1319 @ForceInline
1320 public void intoArray($type$[] a, int ix) {
1321 Objects.requireNonNull(a);
1322 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
1323 VectorIntrinsics.store($vectortype$.class, $type$.class, LENGTH,
1324 a, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
1325 this,
1326 a, ix,
1327 (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e));
1328 }
1329
1330 @Override
1835 $masktype$ m = ($masktype$)o;
1836 return VectorIntrinsics.binaryOp(VECTOR_OP_OR, $masktype$.class, $bitstype$.class, LENGTH,
1837 this, m,
1838 (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
1839 }
1840
1841 // Reductions
1842
1843 @Override
1844 @ForceInline
1845 public boolean anyTrue() {
1846 return VectorIntrinsics.test(BT_ne, $masktype$.class, $bitstype$.class, LENGTH,
1847 this, this,
1848 (m, __) -> anyTrueHelper((($masktype$)m).getBits()));
1849 }
1850
1851 @Override
1852 @ForceInline
1853 public boolean allTrue() {
1854 return VectorIntrinsics.test(BT_overflow, $masktype$.class, $bitstype$.class, LENGTH,
1855 this, Mask.maskAllTrue(species()),
1856 (m, __) -> allTrueHelper((($masktype$)m).getBits()));
1857 }
1858 }
1859
1860 // Shuffle
1861
1862 static final class $shuffletype$ extends AbstractShuffle<$Boxtype$> {
1863 $shuffletype$(byte[] reorder) {
1864 super(reorder);
1865 }
1866
1867 public $shuffletype$(int[] reorder) {
1868 super(reorder);
1869 }
1870
1871 public $shuffletype$(int[] reorder, int i) {
1872 super(reorder, i);
1873 }
1874
1875 public $shuffletype$(IntUnaryOperator f) {
1899 Class<?> stype = species.elementType();
1900 int [] shuffleArray = toArray();
1901 if (stype == byte.class) {
1902 return (Shuffle<F>) new Byte$bits$Vector.Byte$bits$Shuffle(shuffleArray);
1903 } else if (stype == short.class) {
1904 return (Shuffle<F>) new Short$bits$Vector.Short$bits$Shuffle(shuffleArray);
1905 } else if (stype == int.class) {
1906 return (Shuffle<F>) new Int$bits$Vector.Int$bits$Shuffle(shuffleArray);
1907 } else if (stype == long.class) {
1908 return (Shuffle<F>) new Long$bits$Vector.Long$bits$Shuffle(shuffleArray);
1909 } else if (stype == float.class) {
1910 return (Shuffle<F>) new Float$bits$Vector.Float$bits$Shuffle(shuffleArray);
1911 } else if (stype == double.class) {
1912 return (Shuffle<F>) new Double$bits$Vector.Double$bits$Shuffle(shuffleArray);
1913 } else {
1914 throw new UnsupportedOperationException("Bad lane type for casting.");
1915 }
1916 }
1917
1918 @Override
1919 public $shuffletype$ rearrange(Shuffle<$Boxtype$> o) {
1920 $shuffletype$ s = ($shuffletype$) o;
1921 byte[] r = new byte[reorder.length];
1922 for (int i = 0; i < reorder.length; i++) {
1923 r[i] = reorder[s.reorder[i]];
1924 }
1925 return new $shuffletype$(r);
1926 }
1927 }
1928
1929 // Species
1930
1931 @Override
1932 public Species<$Boxtype$> species() {
1933 return SPECIES;
1934 }
1935 }
|