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

Breadcrumb

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

function BigInteger::getLowestSetBit

Returns the index of the rightmost (lowest-order) one bit in this BigInteger.

Returns -1 if this BigInteger contains no one bits.

File

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

Class

BigInteger
An arbitrary-size integer.

Namespace

Brick\Math

Code

public function getLowestSetBit() : int {
    $n = $this;
    $bitLength = $this->getBitLength();
    for ($i = 0; $i <= $bitLength; $i++) {
        if ($n->isOdd()) {
            return $i;
        }
        $n = $n->shiftedRight(1);
    }
    return -1;
}

API Navigation

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