You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/10/13 16:47:06 UTC
(commons-net) 02/02: Compute high bound once in SubnetUtils.SubnetInfo.getAllAddresses()
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 8db8b80257f0f2dc5928d2ef187ed1dbceafdcd6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Oct 13 12:46:59 2024 -0400
Compute high bound once in SubnetUtils.SubnetInfo.getAllAddresses()
---
src/main/java/org/apache/commons/net/util/SubnetUtils.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/net/util/SubnetUtils.java b/src/main/java/org/apache/commons/net/util/SubnetUtils.java
index f4ec9d8f..8e411c82 100644
--- a/src/main/java/org/apache/commons/net/util/SubnetUtils.java
+++ b/src/main/java/org/apache/commons/net/util/SubnetUtils.java
@@ -155,7 +155,8 @@ public class SubnetUtils {
if (ct == 0) {
return addresses;
}
- for (int add = low(), j = 0; add <= high(); ++add, ++j) {
+ final int high = high();
+ for (int add = low(), j = 0; add <= high; ++add, ++j) {
addresses[j] = format(toArray4(add));
}
return addresses;