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

Breadcrumb

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

function GPBWire::varint32Size

4 calls to GPBWire::varint32Size()
GPBWire::sint32Size in vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php
GPBWire::tagSize in vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php
Message::fieldByteSize in vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php
@ignore
Message::fieldDataOnlyByteSize in vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php
@ignore

File

vendor/google/protobuf/src/Google/Protobuf/Internal/GPBWire.php, line 384

Class

GPBWire

Namespace

Google\Protobuf\Internal

Code

public static function varint32Size($value, $sign_extended = false) {
    if ($value < 0) {
        if ($sign_extended) {
            return 10;
        }
        else {
            return 5;
        }
    }
    if ($value < 1 << 7) {
        return 1;
    }
    if ($value < 1 << 14) {
        return 2;
    }
    if ($value < 1 << 21) {
        return 3;
    }
    if ($value < 1 << 28) {
        return 4;
    }
    return 5;
}
RSS feed
Powered by Drupal