< prev index next >

test/jdk/jdk/incubator/vector/VectorArrays.java

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level

*** 21,31 **** * questions. */ import jdk.incubator.vector.ByteVector; import jdk.incubator.vector.Vector; ! import jdk.incubator.vector.Vector.Species; public class VectorArrays { static boolean equals(byte[] a, byte[] b) { if (a == b) return true; --- 21,32 ---- * questions. */ import jdk.incubator.vector.ByteVector; import jdk.incubator.vector.Vector; ! import jdk.incubator.vector.VectorSpecies; ! import jdk.incubator.vector.VectorMask; public class VectorArrays { static boolean equals(byte[] a, byte[] b) { if (a == b) return true;
*** 53,77 **** return a.length - b.length; } static int mismatch(byte[] a, byte[] b) { ! Species<Byte> species = ByteVector.SPECIES_256; return mismatch(a, b, species); } ! static int mismatch(byte[] a, byte[] b, Species<Byte> species) { int length = Math.min(a.length, b.length); if (a == b) return -1; int i = 0; // @@@ Method on species to truncate the length? for (; i < (length & ~(species.length() - 1)); i += species.length()) { Vector<Byte> va = ByteVector.fromArray(species, a, i); Vector<Byte> vb = ByteVector.fromArray(species, b, i); ! Vector.Mask<Byte> m = va.notEqual(vb); // @@@ count number of leading zeros with explicit method if (m.anyTrue()) { break; // mismatch found } } --- 54,78 ---- return a.length - b.length; } static int mismatch(byte[] a, byte[] b) { ! VectorSpecies<Byte> species = ByteVector.SPECIES_256; return mismatch(a, b, species); } ! static int mismatch(byte[] a, byte[] b, VectorSpecies<Byte> species) { int length = Math.min(a.length, b.length); if (a == b) return -1; int i = 0; // @@@ Method on species to truncate the length? for (; i < (length & ~(species.length() - 1)); i += species.length()) { Vector<Byte> va = ByteVector.fromArray(species, a, i); Vector<Byte> vb = ByteVector.fromArray(species, b, i); ! VectorMask<Byte> m = va.notEqual(vb); // @@@ count number of leading zeros with explicit method if (m.anyTrue()) { break; // mismatch found } }
< prev index next >