commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Makoto Sakaguchi (JIRA)" <>
Subject [jira] [Created] (NET-622) SubnetInfo#getCidrSignature - improve functions
Date Sat, 04 Mar 2017 09:49:45 GMT
Makoto Sakaguchi created NET-622:

             Summary: SubnetInfo#getCidrSignature - improve functions
                 Key: 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.
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));

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

This message was sent by Atlassian JIRA

View raw message