Count the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number.
(number, bits)
| 179 | |
| 180 | |
| 181 | def _count_righthand_zero_bits(number, bits): |
| 182 | """Count the number of zero bits on the right hand side. |
| 183 | |
| 184 | Args: |
| 185 | number: an integer. |
| 186 | bits: maximum number of bits to count. |
| 187 | |
| 188 | Returns: |
| 189 | The number of zero bits on the right hand side of the number. |
| 190 | |
| 191 | """ |
| 192 | if number == 0: |
| 193 | return bits |
| 194 | return min(bits, (~number & (number-1)).bit_length()) |
| 195 | |
| 196 | |
| 197 | def summarize_address_range(first, last): |
no test coverage detected
searching dependent graphs…