You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2020/01/29 10:14:27 UTC

[sis] branch geoapi-4.0 updated: The call to Arrays.sort(…) make unecessary the attempt to write indice in increasing order, which we the purpose of System.arraycopy(…) call.

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 <ma...@geomatys.com>
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);