peephole optimization

This commit is contained in:
Leijurv 2018-08-05 17:16:16 -04:00
parent d74660f7e5
commit f252e20dfe
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -56,8 +56,9 @@ public class BinaryHeapOpenSet implements IOpenSet {
throw new IllegalStateException();
}
PathNode result = array[1];
array[1] = array[size];
array[1].heapPosition = 1;
PathNode val = array[size];
array[1] = val;
val.heapPosition = 1;
array[size] = null;
size--;
result.heapPosition = -1;
@ -66,7 +67,6 @@ public class BinaryHeapOpenSet implements IOpenSet {
}
int index = 1;
int smallerChild = 2;
PathNode val = array[index];
double cost = val.combinedCost;
do {
int right = smallerChild + 1;