function GPBUtil::divideInt64ToInt32
2 calls to GPBUtil::divideInt64ToInt32()
- CodedOutputStream::writeLittleEndian64ToArray in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ CodedOutputStream.php - CodedOutputStream::writeVarintToArray in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ CodedOutputStream.php
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ GPBUtil.php, line 37
Class
Namespace
Google\Protobuf\InternalCode
public static function divideInt64ToInt32($value, &$high, &$low, $trim = false) {
$isNeg = bccomp($value, 0) < 0;
if ($isNeg) {
$value = bcsub(0, $value);
}
$high = bcdiv($value, 4294967296);
$low = bcmod($value, 4294967296);
if (bccomp($high, 2147483647) > 0) {
$high = (int) bcsub($high, 4294967296);
}
else {
$high = (int) $high;
}
if (bccomp($low, 2147483647) > 0) {
$low = (int) bcsub($low, 4294967296);
}
else {
$low = (int) $low;
}
if ($isNeg) {
$high = ~$high;
$low = ~$low;
$low++;
if (!$low) {
$high = (int) ($high + 1);
}
}
if ($trim) {
$high = 0;
}
}