This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 3f6570e The call to Arrays.sort(…) make unecessary the attempt to
write indice in increasing order, which we the purpose of System.arraycopy(…)
call.
3f6570e is described below
commit 3f6570e2d7f969a0a269b9b652dc356378d80d95
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Jan 29 11:13:18 2020 +0100
The call to Arrays.sort(…) make unecessary the attempt to write indice in
increasing order, which we the purpose of System.arraycopy(…) call.
---
.../src/main/java/org/apache/sis/coverage/grid/GridExtent.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index 0c3c748..6316ac4 100644
---
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -748,14 +748,12 @@ public class GridExtent implements GridEnvelope,
Serializable {
}
}
}
- final int missing = s - count;
- if (missing != 0) {
- System.arraycopy(selected, 0, selected, missing, count);
- count = 0;
- for (int i=0; ; i++) { // An
IndexOutOfBoundsException would be a bug in our algorithm.
+ if (s != count) {
+ for (int i=0; ; i++) {
+ // An IndexOutOfBoundsException would be a bug in our
algorithm.
if (coordinates[i] == coordinates[i+m]) {
selected[count++] = i;
- if (count == missing) break;
+ if (count == s) break;
}
}
Arrays.sort(selected);