Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BigInteger.php

function BigInteger::shiftedRight

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

1 call to BigInteger::shiftedRight()
BigInteger::shiftedLeft in vendor/brick/math/src/BigInteger.php
Returns the integer left shifted by a given number of bits.

File

vendor/brick/math/src/BigInteger.php, line 766

Class

BigInteger
An arbitrary-size integer.

Namespace

Brick\Math

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal