MCPcopy Index your code
hub / github.com/retspen/webvirtcloud / _count0Bits

Function _count0Bits

vrtManager/IPy.py:1197–1210  ·  view source on GitHub ↗

Find the highest bit set to 0 in an integer.

(num)

Source from the content-addressed store, hash-verified

1195
1196
1197def _count0Bits(num):
1198 """Find the highest bit set to 0 in an integer."""
1199
1200 # this could be so easy if _count1Bits(~long(num)) would work as excepted
1201 num = long(num)
1202 if num < 0:
1203 raise ValueError, "Only positive Numbers please: %s" % (num)
1204 ret = 0
1205 while num > 0:
1206 if num & 1 == 1:
1207 break
1208 num = num >> 1
1209 ret += 1
1210 return ret
1211
1212
1213def _checkPrefix(ip, prefixlen, version):

Callers 2

_checkPrefixFunction · 0.85
_netmaskToPrefixlenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected