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

Breadcrumb

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

function CodedOutputStream::writeVarintToArray

3 calls to CodedOutputStream::writeVarintToArray()
CodedOutputStream::writeVarint32 in vendor/google/protobuf/src/Google/Protobuf/Internal/CodedOutputStream.php
CodedOutputStream::writeVarint64 in vendor/google/protobuf/src/Google/Protobuf/Internal/CodedOutputStream.php
Message::skipField in vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php
@ignore

File

vendor/google/protobuf/src/Google/Protobuf/Internal/CodedOutputStream.php, line 81

Class

CodedOutputStream

Namespace

Google\Protobuf\Internal

Code

public static function writeVarintToArray($value, &$buffer, $trim = false) {
    $current = 0;
    $high = 0;
    $low = 0;
    if (PHP_INT_SIZE == 4) {
        GPBUtil::divideInt64ToInt32($value, $high, $low, $trim);
    }
    else {
        $low = $value;
    }
    while ($low >= 0x80 || $low < 0 || $high != 0) {
        $buffer[$current] = chr($low | 0x80);
        $value = $value >> 7 & ~(0x7f << (PHP_INT_SIZE << 3) - 7);
        $carry = ($high & 0x7f) << (PHP_INT_SIZE << 3) - 7;
        $high = $high >> 7 & ~(0x7f << (PHP_INT_SIZE << 3) - 7);
        $low = $low >> 7 & ~(0x7f << (PHP_INT_SIZE << 3) - 7) | $carry;
        $current++;
    }
    $buffer[$current] = chr($low);
    return $current + 1;
}
RSS feed
Powered by Drupal