Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E3796200C3C for ; Sun, 5 Mar 2017 00:56:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E2075160B7F; Sat, 4 Mar 2017 23:56:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3815C160B71 for ; Sun, 5 Mar 2017 00:56:54 +0100 (CET) Received: (qmail 43972 invoked by uid 500); 4 Mar 2017 23:56:52 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 43961 invoked by uid 99); 4 Mar 2017 23:56:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Mar 2017 23:56:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 45642C23D1 for ; Sat, 4 Mar 2017 23:56:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.652 X-Spam-Level: X-Spam-Status: No, score=0.652 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id FobwUwsHAoPy for ; Sat, 4 Mar 2017 23:56:51 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id EF9795FACA for ; Sat, 4 Mar 2017 23:56:50 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E316DE0051 for ; Sat, 4 Mar 2017 23:56:46 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id F08DD24156 for ; Sat, 4 Mar 2017 23:56:45 +0000 (UTC) Date: Sat, 4 Mar 2017 23:56:45 +0000 (UTC) From: "Makoto Sakaguchi (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (NET-622) SubnetInfo#getCidrSignature - improve functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 04 Mar 2017 23:56:55 -0000 [ https://issues.apache.org/jira/browse/NET-622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Makoto Sakaguchi updated NET-622: --------------------------------- Description: The processing part of "netmask" is converted an integer to a string to an integer. {code} /* SubnetUtils.SubnetInfo#getCidrSignature() */ // a binary mask address int netmask = 0b11111111000000000000000000000000; // convert to a dotted decimal address String maskStr = format(toArray(netmask)); // maskStr: "255.0.0.0" /* SubnetUtils#toCidrNotation() */ // counting the 1-bit population int cidr = pop(toInteger(maskStr)); // cidr: 8 {code} So, I suggest to create CIDR from the netmask variable. https://github.com/apache/commons-net/pull/10 was: The processing part of "netmask" is converted an integer to a string to an integer. {code} /* SubnetUtils.SubnetInfo#getCidrSignature() */ // a binary mask address int netmask = 0b11111111000000000000000000000000; // convert to a dotted decimal address String maskStr = format(toArray(netmask)); // maskStr: "255.0.0.0" /* SubnetUtils#toCidrNotation() */ // counting the 1-bit population int cidr = pop(toInteger(maskStr)); // cidr: 8 {code} So, I suggest to create CIDR from the netmask variable. https://github.com/apache/commons-net/pull/9 > SubnetInfo#getCidrSignature - improve functions > ----------------------------------------------- > > Key: NET-622 > URL: https://issues.apache.org/jira/browse/NET-622 > Project: Commons Net > Issue Type: Improvement > Reporter: Makoto Sakaguchi > Priority: Minor > > The processing part of "netmask" is converted an integer to a string to an integer. > {code} > /* SubnetUtils.SubnetInfo#getCidrSignature() */ > // a binary mask address > int netmask = 0b11111111000000000000000000000000; > // convert to a dotted decimal address > String maskStr = format(toArray(netmask)); // maskStr: "255.0.0.0" > /* SubnetUtils#toCidrNotation() */ > // counting the 1-bit population > int cidr = pop(toInteger(maskStr)); // cidr: 8 > {code} > So, I suggest to create CIDR from the netmask variable. > https://github.com/apache/commons-net/pull/10 -- This message was sent by Atlassian JIRA (v6.3.15#6346)