summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-09-07 13:18:22 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-09-08 12:08:34 +0000
commit10571ccb4ca3d7c6986337e52642762a8040fb55 (patch)
treedea560c1a22a687b7d4b55d7db226351edfe6e3c
parenta7ec49f431f5aaaed8c4ef0ab8b5676a9703dc27 (diff)
Ipv4AddressRange: remove unnecessary double->int convertion
Should fix https://sonar.fd.io/issues/search#issues=AViCMnel_ATy1iJVe-79 Change-Id: I798930dea057cac93ab95b6c1d6f660a21d84e74 Signed-off-by: Marek Gradzki <mgradzki@cisco.com> (cherry picked from commit ec10ef034e4b06cf49ee7ffa509f53a3b3872ec2)
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv4AddressRange.java8
1 files changed, 2 insertions, 6 deletions
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv4AddressRange.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv4AddressRange.java
index 5f014d053..0a8398ab7 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv4AddressRange.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv4AddressRange.java
@@ -20,16 +20,12 @@ import java.util.Objects;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* IPv4 address range representation.
*/
public final class Ipv4AddressRange {
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4AddressRange.class);
-
private final Ipv4AddressNoZone start;
private final Ipv4AddressNoZone end;
@@ -100,10 +96,10 @@ public final class Ipv4AddressRange {
// Take care of the rest
if (prefixLength != 0) {
- final int mask0 = (byte) (Math.pow(2, prefixLength) - 1) << (8 - prefixLength);
+ final int mask0 = (byte) ((1 << prefixLength) - 1) << (8 - prefixLength);
prefixAddrBytes0[index] = (byte) (prefixAddrBytes[index] & mask0);
- final int maskF = (byte) (Math.pow(2, 8 - prefixLength) - 1);
+ final int maskF = (byte) ((1 << (8 - prefixLength)) - 1);
prefixAddrBytesF[index] = (byte) (prefixAddrBytes[index] | maskF);
index++;