1079 0,
1080 (z -> Long64Mask.FALSE_MASK));
1081 }
1082
1083 @Override
1084 @ForceInline
1085 public Long64Vector fromArray(long[] a, int ix) {
1086 Objects.requireNonNull(a);
1087 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
1088 return (Long64Vector) VectorIntrinsics.load(Long64Vector.class, long.class, LENGTH,
1089 a, ix,
1090 (arr, idx) -> super.fromArray((long[]) arr, idx));
1091 }
1092
1093 @Override
1094 @ForceInline
1095 public Long64Vector fromArray(long[] a, int ax, Mask<Long, Shapes.S64Bit> m) {
1096 return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]);
1097 }
1098
1099 @Override
1100 @ForceInline
1101 @SuppressWarnings("unchecked")
1102 public <F> Long64Vector rebracket(Vector<F, Shapes.S64Bit> o) {
1103 Objects.requireNonNull(o);
1104 if (o.elementType() == byte.class) {
1105 Byte64Vector so = (Byte64Vector)o;
1106 return VectorIntrinsics.reinterpret(
1107 Byte64Vector.class, byte.class, so.length(),
1108 long.class, LENGTH, so,
1109 (v, t) -> (Long64Vector)reshape(v)
1110 );
1111 } else if (o.elementType() == short.class) {
1112 Short64Vector so = (Short64Vector)o;
1113 return VectorIntrinsics.reinterpret(
1114 Short64Vector.class, short.class, so.length(),
1115 long.class, LENGTH, so,
1116 (v, t) -> (Long64Vector)reshape(v)
1117 );
1118 } else if (o.elementType() == int.class) {
1127 return VectorIntrinsics.reinterpret(
1128 Long64Vector.class, long.class, so.length(),
1129 long.class, LENGTH, so,
1130 (v, t) -> (Long64Vector)reshape(v)
1131 );
1132 } else if (o.elementType() == float.class) {
1133 Float64Vector so = (Float64Vector)o;
1134 return VectorIntrinsics.reinterpret(
1135 Float64Vector.class, float.class, so.length(),
1136 long.class, LENGTH, so,
1137 (v, t) -> (Long64Vector)reshape(v)
1138 );
1139 } else if (o.elementType() == double.class) {
1140 Double64Vector so = (Double64Vector)o;
1141 return VectorIntrinsics.reinterpret(
1142 Double64Vector.class, double.class, so.length(),
1143 long.class, LENGTH, so,
1144 (v, t) -> (Long64Vector)reshape(v)
1145 );
1146 } else {
1147 throw new InternalError("Unimplemented size");
1148 }
1149 }
1150
1151 @Override
1152 @ForceInline
1153 @SuppressWarnings("unchecked")
1154 public <T extends Shape> Long64Vector resize(Vector<Long, T> o) {
1155 Objects.requireNonNull(o);
1156 if (o.bitSize() == 64) {
1157 Long64Vector so = (Long64Vector)o;
1158 return VectorIntrinsics.reinterpret(
1159 Long64Vector.class, long.class, so.length(),
1160 long.class, LENGTH, so,
1161 (v, t) -> (Long64Vector)reshape(v)
1162 );
1163 } else if (o.bitSize() == 128) {
1164 Long128Vector so = (Long128Vector)o;
1165 return VectorIntrinsics.reinterpret(
1166 Long128Vector.class, long.class, so.length(),
1167 long.class, LENGTH, so,
|
1079 0,
1080 (z -> Long64Mask.FALSE_MASK));
1081 }
1082
1083 @Override
1084 @ForceInline
1085 public Long64Vector fromArray(long[] a, int ix) {
1086 Objects.requireNonNull(a);
1087 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
1088 return (Long64Vector) VectorIntrinsics.load(Long64Vector.class, long.class, LENGTH,
1089 a, ix,
1090 (arr, idx) -> super.fromArray((long[]) arr, idx));
1091 }
1092
1093 @Override
1094 @ForceInline
1095 public Long64Vector fromArray(long[] a, int ax, Mask<Long, Shapes.S64Bit> m) {
1096 return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]);
1097 }
1098
1099 @ForceInline
1100 @SuppressWarnings("unchecked")
1101 private <S extends Shape> Long64Vector castFromByte(ByteVector<S> o) {
1102 if (o.bitSize() == 64) {
1103 Byte64Vector so = (Byte64Vector)o;
1104 return VectorIntrinsics.cast(
1105 Byte64Vector.class, byte.class, so.length(),
1106 long.class, LENGTH, so,
1107 (v, t) -> (Long64Vector)super.cast(v)
1108 );
1109 } else if (o.bitSize() == 128) {
1110 Byte128Vector so = (Byte128Vector)o;
1111 return VectorIntrinsics.cast(
1112 Byte128Vector.class, byte.class, so.length(),
1113 long.class, LENGTH, so,
1114 (v, t) -> (Long64Vector)super.cast(v)
1115 );
1116 } else if (o.bitSize() == 256) {
1117 Byte256Vector so = (Byte256Vector)o;
1118 return VectorIntrinsics.cast(
1119 Byte256Vector.class, byte.class, so.length(),
1120 long.class, LENGTH, so,
1121 (v, t) -> (Long64Vector)super.cast(v)
1122 );
1123 } else if (o.bitSize() == 512) {
1124 Byte512Vector so = (Byte512Vector)o;
1125 return VectorIntrinsics.cast(
1126 Byte512Vector.class, byte.class, so.length(),
1127 long.class, LENGTH, so,
1128 (v, t) -> (Long64Vector)super.cast(v)
1129 );
1130 } else {
1131 throw new InternalError("Unimplemented size");
1132 }
1133 }
1134
1135 @ForceInline
1136 @SuppressWarnings("unchecked")
1137 private <S extends Shape> Long64Vector castFromShort(ShortVector<S> o) {
1138 if (o.bitSize() == 64) {
1139 Short64Vector so = (Short64Vector)o;
1140 return VectorIntrinsics.cast(
1141 Short64Vector.class, short.class, so.length(),
1142 long.class, LENGTH, so,
1143 (v, t) -> (Long64Vector)super.cast(v)
1144 );
1145 } else if (o.bitSize() == 128) {
1146 Short128Vector so = (Short128Vector)o;
1147 return VectorIntrinsics.cast(
1148 Short128Vector.class, short.class, so.length(),
1149 long.class, LENGTH, so,
1150 (v, t) -> (Long64Vector)super.cast(v)
1151 );
1152 } else if (o.bitSize() == 256) {
1153 Short256Vector so = (Short256Vector)o;
1154 return VectorIntrinsics.cast(
1155 Short256Vector.class, short.class, so.length(),
1156 long.class, LENGTH, so,
1157 (v, t) -> (Long64Vector)super.cast(v)
1158 );
1159 } else if (o.bitSize() == 512) {
1160 Short512Vector so = (Short512Vector)o;
1161 return VectorIntrinsics.cast(
1162 Short512Vector.class, short.class, so.length(),
1163 long.class, LENGTH, so,
1164 (v, t) -> (Long64Vector)super.cast(v)
1165 );
1166 } else {
1167 throw new InternalError("Unimplemented size");
1168 }
1169 }
1170
1171 @ForceInline
1172 @SuppressWarnings("unchecked")
1173 private <S extends Shape> Long64Vector castFromInt(IntVector<S> o) {
1174 if (o.bitSize() == 64) {
1175 Int64Vector so = (Int64Vector)o;
1176 return VectorIntrinsics.cast(
1177 Int64Vector.class, int.class, so.length(),
1178 long.class, LENGTH, so,
1179 (v, t) -> (Long64Vector)super.cast(v)
1180 );
1181 } else if (o.bitSize() == 128) {
1182 Int128Vector so = (Int128Vector)o;
1183 return VectorIntrinsics.cast(
1184 Int128Vector.class, int.class, so.length(),
1185 long.class, LENGTH, so,
1186 (v, t) -> (Long64Vector)super.cast(v)
1187 );
1188 } else if (o.bitSize() == 256) {
1189 Int256Vector so = (Int256Vector)o;
1190 return VectorIntrinsics.cast(
1191 Int256Vector.class, int.class, so.length(),
1192 long.class, LENGTH, so,
1193 (v, t) -> (Long64Vector)super.cast(v)
1194 );
1195 } else if (o.bitSize() == 512) {
1196 Int512Vector so = (Int512Vector)o;
1197 return VectorIntrinsics.cast(
1198 Int512Vector.class, int.class, so.length(),
1199 long.class, LENGTH, so,
1200 (v, t) -> (Long64Vector)super.cast(v)
1201 );
1202 } else {
1203 throw new InternalError("Unimplemented size");
1204 }
1205 }
1206
1207 @ForceInline
1208 @SuppressWarnings("unchecked")
1209 private <S extends Shape> Long64Vector castFromLong(LongVector<S> o) {
1210 if (o.bitSize() == 64) {
1211 Long64Vector so = (Long64Vector)o;
1212 return VectorIntrinsics.cast(
1213 Long64Vector.class, long.class, so.length(),
1214 long.class, LENGTH, so,
1215 (v, t) -> (Long64Vector)super.cast(v)
1216 );
1217 } else if (o.bitSize() == 128) {
1218 Long128Vector so = (Long128Vector)o;
1219 return VectorIntrinsics.cast(
1220 Long128Vector.class, long.class, so.length(),
1221 long.class, LENGTH, so,
1222 (v, t) -> (Long64Vector)super.cast(v)
1223 );
1224 } else if (o.bitSize() == 256) {
1225 Long256Vector so = (Long256Vector)o;
1226 return VectorIntrinsics.cast(
1227 Long256Vector.class, long.class, so.length(),
1228 long.class, LENGTH, so,
1229 (v, t) -> (Long64Vector)super.cast(v)
1230 );
1231 } else if (o.bitSize() == 512) {
1232 Long512Vector so = (Long512Vector)o;
1233 return VectorIntrinsics.cast(
1234 Long512Vector.class, long.class, so.length(),
1235 long.class, LENGTH, so,
1236 (v, t) -> (Long64Vector)super.cast(v)
1237 );
1238 } else {
1239 throw new InternalError("Unimplemented size");
1240 }
1241 }
1242
1243 @ForceInline
1244 @SuppressWarnings("unchecked")
1245 private <S extends Shape> Long64Vector castFromFloat(FloatVector<S> o) {
1246 if (o.bitSize() == 64) {
1247 Float64Vector so = (Float64Vector)o;
1248 return VectorIntrinsics.cast(
1249 Float64Vector.class, float.class, so.length(),
1250 long.class, LENGTH, so,
1251 (v, t) -> (Long64Vector)super.cast(v)
1252 );
1253 } else if (o.bitSize() == 128) {
1254 Float128Vector so = (Float128Vector)o;
1255 return VectorIntrinsics.cast(
1256 Float128Vector.class, float.class, so.length(),
1257 long.class, LENGTH, so,
1258 (v, t) -> (Long64Vector)super.cast(v)
1259 );
1260 } else if (o.bitSize() == 256) {
1261 Float256Vector so = (Float256Vector)o;
1262 return VectorIntrinsics.cast(
1263 Float256Vector.class, float.class, so.length(),
1264 long.class, LENGTH, so,
1265 (v, t) -> (Long64Vector)super.cast(v)
1266 );
1267 } else if (o.bitSize() == 512) {
1268 Float512Vector so = (Float512Vector)o;
1269 return VectorIntrinsics.cast(
1270 Float512Vector.class, float.class, so.length(),
1271 long.class, LENGTH, so,
1272 (v, t) -> (Long64Vector)super.cast(v)
1273 );
1274 } else {
1275 throw new InternalError("Unimplemented size");
1276 }
1277 }
1278
1279 @ForceInline
1280 @SuppressWarnings("unchecked")
1281 private <S extends Shape> Long64Vector castFromDouble(DoubleVector<S> o) {
1282 if (o.bitSize() == 64) {
1283 Double64Vector so = (Double64Vector)o;
1284 return VectorIntrinsics.cast(
1285 Double64Vector.class, double.class, so.length(),
1286 long.class, LENGTH, so,
1287 (v, t) -> (Long64Vector)super.cast(v)
1288 );
1289 } else if (o.bitSize() == 128) {
1290 Double128Vector so = (Double128Vector)o;
1291 return VectorIntrinsics.cast(
1292 Double128Vector.class, double.class, so.length(),
1293 long.class, LENGTH, so,
1294 (v, t) -> (Long64Vector)super.cast(v)
1295 );
1296 } else if (o.bitSize() == 256) {
1297 Double256Vector so = (Double256Vector)o;
1298 return VectorIntrinsics.cast(
1299 Double256Vector.class, double.class, so.length(),
1300 long.class, LENGTH, so,
1301 (v, t) -> (Long64Vector)super.cast(v)
1302 );
1303 } else if (o.bitSize() == 512) {
1304 Double512Vector so = (Double512Vector)o;
1305 return VectorIntrinsics.cast(
1306 Double512Vector.class, double.class, so.length(),
1307 long.class, LENGTH, so,
1308 (v, t) -> (Long64Vector)super.cast(v)
1309 );
1310 } else {
1311 throw new InternalError("Unimplemented size");
1312 }
1313 }
1314
1315 @Override
1316 @ForceInline
1317 @SuppressWarnings("unchecked")
1318 public <E, S extends Shape> Long64Vector cast(Vector<E, S> o) {
1319 Objects.requireNonNull(o);
1320 if (o.elementType() == byte.class) {
1321 ByteVector<S> so = (ByteVector<S>)o;
1322 return castFromByte(so);
1323 } else if (o.elementType() == short.class) {
1324 ShortVector<S> so = (ShortVector<S>)o;
1325 return castFromShort(so);
1326 } else if (o.elementType() == int.class) {
1327 IntVector<S> so = (IntVector<S>)o;
1328 return castFromInt(so);
1329 } else if (o.elementType() == long.class) {
1330 LongVector<S> so = (LongVector<S>)o;
1331 return castFromLong(so);
1332 } else if (o.elementType() == float.class) {
1333 FloatVector<S> so = (FloatVector<S>)o;
1334 return castFromFloat(so);
1335 } else if (o.elementType() == double.class) {
1336 DoubleVector<S> so = (DoubleVector<S>)o;
1337 return castFromDouble(so);
1338 } else {
1339 throw new InternalError("Unimplemented type");
1340 }
1341 }
1342
1343 @Override
1344 @ForceInline
1345 @SuppressWarnings("unchecked")
1346 public <F> Long64Vector rebracket(Vector<F, Shapes.S64Bit> o) {
1347 Objects.requireNonNull(o);
1348 if (o.elementType() == byte.class) {
1349 Byte64Vector so = (Byte64Vector)o;
1350 return VectorIntrinsics.reinterpret(
1351 Byte64Vector.class, byte.class, so.length(),
1352 long.class, LENGTH, so,
1353 (v, t) -> (Long64Vector)reshape(v)
1354 );
1355 } else if (o.elementType() == short.class) {
1356 Short64Vector so = (Short64Vector)o;
1357 return VectorIntrinsics.reinterpret(
1358 Short64Vector.class, short.class, so.length(),
1359 long.class, LENGTH, so,
1360 (v, t) -> (Long64Vector)reshape(v)
1361 );
1362 } else if (o.elementType() == int.class) {
1371 return VectorIntrinsics.reinterpret(
1372 Long64Vector.class, long.class, so.length(),
1373 long.class, LENGTH, so,
1374 (v, t) -> (Long64Vector)reshape(v)
1375 );
1376 } else if (o.elementType() == float.class) {
1377 Float64Vector so = (Float64Vector)o;
1378 return VectorIntrinsics.reinterpret(
1379 Float64Vector.class, float.class, so.length(),
1380 long.class, LENGTH, so,
1381 (v, t) -> (Long64Vector)reshape(v)
1382 );
1383 } else if (o.elementType() == double.class) {
1384 Double64Vector so = (Double64Vector)o;
1385 return VectorIntrinsics.reinterpret(
1386 Double64Vector.class, double.class, so.length(),
1387 long.class, LENGTH, so,
1388 (v, t) -> (Long64Vector)reshape(v)
1389 );
1390 } else {
1391 throw new InternalError("Unimplemented type");
1392 }
1393 }
1394
1395 @Override
1396 @ForceInline
1397 @SuppressWarnings("unchecked")
1398 public <T extends Shape> Long64Vector resize(Vector<Long, T> o) {
1399 Objects.requireNonNull(o);
1400 if (o.bitSize() == 64) {
1401 Long64Vector so = (Long64Vector)o;
1402 return VectorIntrinsics.reinterpret(
1403 Long64Vector.class, long.class, so.length(),
1404 long.class, LENGTH, so,
1405 (v, t) -> (Long64Vector)reshape(v)
1406 );
1407 } else if (o.bitSize() == 128) {
1408 Long128Vector so = (Long128Vector)o;
1409 return VectorIntrinsics.reinterpret(
1410 Long128Vector.class, long.class, so.length(),
1411 long.class, LENGTH, so,
|