------
## 最终结论
```python
def divide(dividend: int, divisor: int) -> int:
    # Check for overflow and special cases
    if dividend == -2**31 and divisor == -1:
        return 2**31 - 1  # Overflow case
    if divisor == 0:
        raise ValueError("Divisor cannot be zero")
    
    # Determine the sign of the result
    negative = (dividend < 0) ^ (divisor < 0)
    
    # Convert both dividend and divisor to positive numbers
    dividend = abs(dividend)
    divisor = abs(divisor)
    
    # Initialize quotient and a temporary variable for calculations
    quotient = 0
    
    # Use bit shifting to perform division
    while dividend >= divisor:
        temp = divisor
        multiple = 1
        
        # Find the largest multiple of divisor that fits into dividend
        while dividend >= (temp << 1):
            temp <<= 1
            multiple <<= 1
        
        # Subtract the found multiple from dividend and add to quotient
        dividend -= temp
        quotient += multiple
    
    # Apply the sign to the quotient
    if negative:
        quotient = -quotient
    
    # Ensure the result is within the 32-bit signed integer range
    return min(max(-2**31, quotient), 2**31 - 1)
```