Exemplo n.º 1
0
 def routingprefixlength(self):
     """Return an integer."""
     netmask = IPAddress.asList(self.netmask)
     # for an easy way to determine the highest bit set see https://wiki.python.org/moin/BitManipulation
     return 8 * len(netmask) - int(
         math.floor(
             math.log(
                 IPAddress.asInteger(IPAddress.bitNot(netmask)) + 1, 2)))
Exemplo n.º 2
0
 def routingprefixlength(self):
     """Return an integer."""
     netmask = IPAddress.asList(self.netmask)
     # for an easy way to determine the highest bit set see https://wiki.python.org/moin/BitManipulation
     return 8 * len(netmask) - int(math.floor(math.log(IPAddress.asInteger(IPAddress.bitNot(netmask)) + 1, 2)))