public function shiftedRight(int $distance) : BigInteger
    {
        if ($distance === 0) {
            return $this;
        }

        if ($distance < 0) {
            return $this->shiftedLeft(- $distance);
        }

        $operand = BigInteger::of(2)->power($distance);

        if ($this->isPositiveOrZero()) {
            return $this->quotient($operand);
        }

        return $this->dividedBy($operand, RoundingMode::UP);
    }
public function shiftedRight(int $distance) : BigInteger
    {
        if ($distance === 0) {
            return $this;
        }

        if ($distance < 0) {
            return $this->shiftedLeft(- $distance);
        }

        $operand = BigInteger::of(2)->power($distance);

        if ($this->isPositiveOrZero()) {
            return $this->quotient($operand);
        }

        return $this->dividedBy($operand, RoundingMode::UP);
    }
public function shiftedRight ( int $ distance ) : BigInteger { if ( $ distance === 0 ) { return $ this ; } if ( $ distance < 0 ) { return $ this -> shiftedLeft ( - $ distance ) ; } $ operand = BigInteger :: of ( 2 ) -> power ( $ distance ) ; if ( $ this -> isPositiveOrZero ( ) ) { return $ this -> quotient ( $ operand ) ; } return $ this -> dividedBy ( $ operand , RoundingMode :: UP ) ; }
Returns the integer right shifted by a given number of bits.

@param int $distance The distance to shift.

@return BigInteger
Returns the integer right shifted by a given number of bits .