minor optimization on ary ctors

This commit is contained in:
Jonathan Shook 2023-09-07 10:54:44 -05:00
parent 8eb3620caf
commit 31fb6eae7d

View File

@ -69,7 +69,7 @@ public class Intersections {
}
public static int[] find(int[] reference, int[] sample, int limit) {
int[] result = new int[reference.length];
int[] result = new int[limit];
int a_index = 0, b_index = 0, acc_index = -1;
int a_element, b_element;
while (a_index < reference.length && a_index < limit && b_index < sample.length && b_index < limit) {
@ -93,7 +93,7 @@ public class Intersections {
return find(reference, sample, reference.length);
}
public static long[] find(long[] reference, long[] sample, int limit) {
long[] result = new long[reference.length];
long[] result = new long[limit];
int a_index = 0, b_index = 0, acc_index = -1;
long a_element, b_element;
while (a_index < reference.length && a_index < limit && b_index < sample.length && b_index < limit) {