Find the highest bit set to 0 in an integer.
(num)
| 1195 | |
| 1196 | |
| 1197 | def _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 | |
| 1213 | def _checkPrefix(ip, prefixlen, version): |
no outgoing calls
no test coverage detected