summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils/src
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-09-07 13:18:22 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-09-07 11:23:09 +0000
commitec10ef034e4b06cf49ee7ffa509f53a3b3872ec2 (patch)
treeda1e4638c12024c2a3f088c9cc4a4f48ee4c5ecd /vpp-common/vpp-translate-utils/src
parentfc809432b5560bf36e7d5b14b998751ed0e9a229 (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>
Diffstat (limited to 'vpp-common/vpp-translate-utils/src')
-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++;