You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/06/20 06:58:15 UTC

[GitHub] [commons-numbers] aherbert commented on a change in pull request #99: Replace manual copying of array contents by calls to System.arraycopy().

aherbert commented on a change in pull request #99:
URL: https://github.com/apache/commons-numbers/pull/99#discussion_r654887776



##########
File path: commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/FactorialDouble.java
##########
@@ -64,9 +64,7 @@ private FactorialDouble(int numValues,
         }
 
         // Copy available values.
-        for (int i = beginCopy; i < endCopy; i++) {
-            factorialsDouble[i] = cache[i];
-        }
+        if (endCopy - 2 >= 0) System.arraycopy(cache, beginCopy, factorialsDouble, beginCopy, endCopy - 2);

Review comment:
       This will fail checkstyle. The logic seems fine.

##########
File path: commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/LogFactorial.java
##########
@@ -62,9 +62,7 @@ private LogFactorial(int numValues,
         }
 
         // Copy available values.
-        for (int i = beginCopy; i < endCopy; i++) {
-            logFactorials[i] = cache[i];
-        }
+        if (endCopy - 2 >= 0) System.arraycopy(cache, beginCopy, logFactorials, beginCopy, endCopy - 2);

Review comment:
       This will fail checkstyle. The logic seems fine.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org