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

Breadcrumb

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

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

GPBUtil

Namespace

Google\Protobuf\Internal

Code

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;
    }
}

API Navigation

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