< prev index next >

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

Print this page
rev 55891 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz
rev 55894 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz

@@ -42,20 +42,20 @@
      * @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
+     * @return the mask type
      */
     abstract Class<?> maskType();
 
     /**
      * Returns the element size, in bits, of vectors produced by this

@@ -67,23 +67,22 @@
 
     /**
      * Returns the shape of masks, shuffles, and vectors produced by this
      * species.
      *
-     * @return the primitive element type
+     * @return the shape
      */
     public abstract VectorShape shape();
 
     /**
      * Returns the shape of the corresponding index species
-     * @return the shape
+     * @return the shape of index species
      */
-    @ForceInline
     public abstract VectorShape indexShape();
 
     /**
-     * Returns the mask, shuffe, or vector lanes produced by this species.
+     * Returns the mask, shuffle, or vector lanes produced by this species.
      *
      * @return the the number of lanes
      */
     default public int length() { return shape().length(this); }
 

@@ -93,10 +92,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 >