< prev index next >

src/java.base/share/classes/java/math/BigInteger.java

Print this page
rev 47483 : [mq]: XXXXXXX-double-trouble-2


2724             throw new IllegalArgumentException("invalid input length: " + len);
2725         }
2726 
2727         if (len > a.length ||
2728             len > b.length ||
2729             len > n.length ||
2730             (product != null && len > product.length)) {
2731             throw new IllegalArgumentException("input array length out of bound: " + len);
2732         }
2733     }
2734 
2735     // Make sure that the int array z (which is expected to contain
2736     // the result of a Montgomery multiplication) is present and
2737     // sufficiently large.
2738     private static int[] materialize(int[] z, int len) {
2739          if (z == null || z.length < len)
2740              z = new int[len];
2741          return z;
2742     }
2743 
2744     // These methods are intended to be be replaced by virtual machine
2745     // intrinsics.
2746     @HotSpotIntrinsicCandidate
2747     private static int[] implMontgomeryMultiply(int[] a, int[] b, int[] n, int len,
2748                                          long inv, int[] product) {
2749         product = multiplyToLen(a, len, b, len, product);
2750         return montReduce(product, n, len, (int)inv);
2751     }
2752     @HotSpotIntrinsicCandidate
2753     private static int[] implMontgomerySquare(int[] a, int[] n, int len,
2754                                        long inv, int[] product) {
2755         product = squareToLen(a, len, product);
2756         return montReduce(product, n, len, (int)inv);
2757     }
2758 
2759     static int[] bnExpModThreshTable = {7, 25, 81, 241, 673, 1793,
2760                                                 Integer.MAX_VALUE}; // Sentinel
2761 
2762     /**
2763      * Returns a BigInteger whose value is x to the power of y mod z.
2764      * Assumes: z is odd && x < z.




2724             throw new IllegalArgumentException("invalid input length: " + len);
2725         }
2726 
2727         if (len > a.length ||
2728             len > b.length ||
2729             len > n.length ||
2730             (product != null && len > product.length)) {
2731             throw new IllegalArgumentException("input array length out of bound: " + len);
2732         }
2733     }
2734 
2735     // Make sure that the int array z (which is expected to contain
2736     // the result of a Montgomery multiplication) is present and
2737     // sufficiently large.
2738     private static int[] materialize(int[] z, int len) {
2739          if (z == null || z.length < len)
2740              z = new int[len];
2741          return z;
2742     }
2743 
2744     // These methods are intended to be replaced by virtual machine
2745     // intrinsics.
2746     @HotSpotIntrinsicCandidate
2747     private static int[] implMontgomeryMultiply(int[] a, int[] b, int[] n, int len,
2748                                          long inv, int[] product) {
2749         product = multiplyToLen(a, len, b, len, product);
2750         return montReduce(product, n, len, (int)inv);
2751     }
2752     @HotSpotIntrinsicCandidate
2753     private static int[] implMontgomerySquare(int[] a, int[] n, int len,
2754                                        long inv, int[] product) {
2755         product = squareToLen(a, len, product);
2756         return montReduce(product, n, len, (int)inv);
2757     }
2758 
2759     static int[] bnExpModThreshTable = {7, 25, 81, 241, 673, 1793,
2760                                                 Integer.MAX_VALUE}; // Sentinel
2761 
2762     /**
2763      * Returns a BigInteger whose value is x to the power of y mod z.
2764      * Assumes: z is odd && x < z.


< prev index next >