public function getNextSet(int $from) : int
    {
        if ($from >= $this->size) {
            return $this->size;
        }

        $bitsOffset = $from >> 5;
        $currentBits = $this->bits[$bitsOffset];
        $bitsLength = count($this->bits);
        $currentBits &= ~((1 << ($from & 0x1f)) - 1);

        while (0 === $currentBits) {
            if (++$bitsOffset === $bitsLength) {
                return $this->size;
            }

            $currentBits = $this->bits[$bitsOffset];
        }

        $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits);
        return $result > $this->size ? $this->size : $result;
    }
public function getNextSet(int $from) : int
    {
        if ($from >= $this->size) {
            return $this->size;
        }

        $bitsOffset = $from >> 5;
        $currentBits = $this->bits[$bitsOffset];
        $bitsLength = count($this->bits);
        $currentBits &= ~((1 << ($from & 0x1f)) - 1);

        while (0 === $currentBits) {
            if (++$bitsOffset === $bitsLength) {
                return $this->size;
            }

            $currentBits = $this->bits[$bitsOffset];
        }

        $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits);
        return $result > $this->size ? $this->size : $result;
    }
public function getNextSet ( int $ from ) : int { if ( $ from >= $ this -> size ) { return $ this -> size ; } $ bitsOffset = $ from >> 5 ; $ currentBits = $ this -> bits [ $ bitsOffset ] ; $ bitsLength = count ( $ this -> bits ) ; $ currentBits &= ~ ( ( 1 << ( $ from & 0x1f ) ) - 1 ) ; while ( 0 === $ currentBits ) { if ( ++ $ bitsOffset === $ bitsLength ) { return $ this -> size ; } $ currentBits = $ this -> bits [ $ bitsOffset ] ; } $ result = ( $ bitsOffset << 5 ) + BitUtils :: numberOfTrailingZeros ( $ currentBits ) ; return $ result > $ this -> size ? $ this -> size : $ result ; }
Gets the next set bit position from a given position.
Gets the next set bit position from a given position .