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
Namespace
Google\Protobuf\InternalCode
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;
}