[ 
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/9


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

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

// 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/9



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

Reply via email to