< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java

Print this page

        

@@ -42,15 +42,15 @@
      * @return the primitive element type
      */
     public abstract Class<E> elementType();
 
     /**
-     * Returns the vector box type for this species
+     * Returns the vector type corresponding to this species
      *
-     * @return the box type
+     * @return the vector type corresponding to this species
      */
-    abstract Class<?> boxType();
+    abstract Class<?> vectorType();
 
     /**
      * Returns the vector mask type for this species
      *
      * @return the box type

@@ -93,10 +93,20 @@
      *
      * @return the total vector size, in bits
      */
     default public int bitSize() { return shape().bitSize(); }
 
+    /**
+     * Helper function to calculate the loop terminating condition when iterating over an array of given length.
+     * Returns the result of {@code (length & ~(this.length() - 1))}
+     *
+     * @return the result of {@code (length & ~(this.length() - 1))}
+     */
+    default public int loopBound(int length) {
+        return length & ~(this.length() - 1);
+    }
+
     // Factory
 
     /**
      * Finds a species for an element type and shape.
      *
< prev index next >