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)
| 182 | |
| 183 | |
| 184 | def _count_righthand_zero_bits(number, bits): |
| 185 | """Count the number of zero bits on the right hand side. |
| 186 | |
| 187 | Args: |
| 188 | number: an integer. |
| 189 | bits: maximum number of bits to count. |
| 190 | |
| 191 | Returns: |
| 192 | The number of zero bits on the right hand side of the number. |
| 193 | |
| 194 | """ |
| 195 | if number == 0: |
| 196 | return bits |
| 197 | return min(bits, (~number & (number-1)).bit_length()) |
| 198 | |
| 199 | |
| 200 | def summarize_address_range(first, last): |
no test coverage detected