(self, addr: int)
return start
Checks which segment that the address `addr` should belong to, and, returns the offset of that segment.
        Note that the address may not actually belong to the block.

        :param addr: The address to search
        :return: The offset of the segment.
Checks which segment that the address `addr` should belong to, and, returns the offset of that segment.
        Note that the address may not actually belong to the block.
Checks which segment that the address addr should belong to and returns the offset of that segment . Note that the address may not actually belong to the block .
def search(self, addr: int) -> int:
        """
        Checks which segment that the address `addr` should belong to, and, returns the offset of that segment.
        Note that the address may not actually belong to the block.

        :param addr: The address to search
        :return: The offset of the segment.
        """

        start = 0
        end = len(self._list)

        while start != end:
            mid = (start + end) // 2

            segment = self._list[mid]
            if addr < segment.start:
                end = mid
            elif addr >= segment.end:
                start = mid + 1
            else:
                # Overlapped :(
                start = mid
                break

        return start
def search ( self , addr : int ) -> int : start = 0 end = len ( self . _list ) while start != end : mid = ( start + end ) // 2 segment = self . _list [ mid ] if addr < segment . start : end = mid elif addr >= segment . end : start = mid + 1 else : # Overlapped :( start = mid break return start