MCPcopy Index your code
hub / github.com/RustPython/RustPython / _count_righthand_zero_bits

Function _count_righthand_zero_bits

Lib/ipaddress.py:184–197  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

182
183
184def _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
200def summarize_address_range(first, last):

Callers 2

summarize_address_rangeFunction · 0.85
_prefix_from_ip_intMethod · 0.85

Calls 2

minFunction · 0.85
bit_lengthMethod · 0.45

Tested by

no test coverage detected