MCPcopy Index your code
hub / github.com/python/cpython / _count_righthand_zero_bits

Function _count_righthand_zero_bits

Lib/ipaddress.py:181–194  ·  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

179
180
181def _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
197def summarize_address_range(first, last):

Callers 2

summarize_address_rangeFunction · 0.85
_prefix_from_ip_intMethod · 0.85

Calls 1

bit_lengthMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…