You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Makoto Sakaguchi (JIRA)" <ji...@apache.org> on 2017/03/04 09:51:45 UTC

[jira] [Updated] (NET-622) SubnetInfo#getCidrSignature - improve functions

     [ 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}
int netmask = 0b11110000000000000000000000000000; // a binary mask address

// convert to a dotted decimal address
String maskStr = format(toArray(netmask));

// counting the 1-bit population
int cidr = pop(toInteger(maskStr));
{code}

So, I suggest to create CIDR from the netmask variable.

  was:
The processing part of "netmask" is converted an integer to a string to an integer.
{code}
int netmask = 0b11110000000000000000000000000000; // a binary netmask

// convert to a dotted decimal address
String maskStr = format(toArray(netmask));

// counting the 1-bit population
int cidr = pop(toInteger(maskStr));
{code}

So, I suggest to create CIDR from the netmask variable.


> 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}
> int netmask = 0b11110000000000000000000000000000; // a binary mask address
> // convert to a dotted decimal address
> String maskStr = format(toArray(netmask));
> // counting the 1-bit population
> int cidr = pop(toInteger(maskStr));
> {code}
> So, I suggest to create CIDR from the netmask variable.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)