sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/05: Increase the limit in the number of dimensions handled by CoordinateFormat from 32 to 64, for consistency with the limits used elswhere in the library.
Date Thu, 03 Jan 2019 16:01:47 GMT
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

commit 5895919f30247d55da9af088f81317447a814f85
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Jan 3 10:00:22 2019 +0100

    Increase the limit in the number of dimensions handled by CoordinateFormat from 32 to
64, for consistency with the limits used elswhere in the library.
---
 .../src/main/java/org/apache/sis/geometry/CoordinateFormat.java   | 8 ++++----
 .../src/main/java/org/apache/sis/internal/util/Numerics.java      | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
b/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
index 32577d6..a535e81 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
@@ -169,7 +169,7 @@ public class CoordinateFormat extends CompoundFormat<DirectPosition>
{
      *
      * @see #negate(int)
      */
-    private transient int negate;
+    private transient long negate;
 
     /**
      * The time epochs. Non-null only if the at least on ordinate is to be formatted as a
date.
@@ -355,17 +355,17 @@ public class CoordinateFormat extends CompoundFormat<DirectPosition>
{
      * Remembers that ordinate values at the given dimension will need to have their sign
reverted.
      */
     private void negate(final int dimension) {
-        if (dimension >= Integer.SIZE) {
+        if (dimension >= Long.SIZE) {
             throw new ArithmeticException(Errors.format(Errors.Keys.ExcessiveNumberOfDimensions_1,
dimension));
         }
-        negate |= (1 << dimension);
+        negate |= (1L << dimension);
     }
 
     /**
      * Returns {@code true} if the value at the given dimension needs to have its sign reversed.
      */
     private boolean isNegative(final int dimension) {
-        return (dimension < Integer.SIZE) && (negate & (1 << dimension))
!= 0;
+        return (dimension < Long.SIZE) && (negate & (1L << dimension))
!= 0;
     }
 
     /**
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
index 8090ef6..60977d6 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
@@ -77,7 +77,7 @@ public final class Numerics extends Static {
      * classes have their number of dimensions limited mostly by the capacity of the {@code
int} primitive type, but
      * we nevertheless set the maximum number of dimensions to a lower value for catching
probable errors. Note that
      * this is not a "universal" limit through Apache SIS, as some algorithms impose a smaller
number of dimensions.
-     * Some limits found in specific Apache SIS code are 20, {@value Integer#SIZE} or {@value
Long#SIZE}.</p>
+     * Some other limits found in specific Apache SIS code are 20 or {@value Long#SIZE}.</p>
      */
     public static final int MAXIMUM_MATRIX_SIZE = Short.MAX_VALUE;
 


Mime
View raw message