Documentation

Base64VLQ
in package

Base 64 VLQ

Based on the Base 64 VLQ implementation in Closure Compiler: https://github.com/google/closure-compiler/blob/master/src/com/google/debugging/sourcemap/Base64VLQ.java

Copyright 2011 The Closure Compiler Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Tags
author

John Lenz johnlenz@google.com

author

Anthon Pang anthon.pang@gmail.com

Table of Contents

VLQ_BASE_MASK  = 31
VLQ_BASE_SHIFT  = 5
VLQ_CONTINUATION_BIT  = 32
decode()  : int
Decodes VLQValue.
encode()  : string
Returns the VLQ encoded value.
fromVLQSigned()  : int
Converts to a two-complement value from a value where the sign bit is is placed in the least significant bit. For example, as decimals: 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
toVLQSigned()  : int
Converts from a two-complement value to a value where the sign bit is is placed in the least significant bit. For example, as decimals: 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)

Constants

VLQ_BASE_MASK

public mixed VLQ_BASE_MASK = 31

VLQ_BASE_SHIFT

public mixed VLQ_BASE_SHIFT = 5

VLQ_CONTINUATION_BIT

public mixed VLQ_CONTINUATION_BIT = 32

Methods

decode()

Decodes VLQValue.

public static decode(string $str, int &$index) : int
Parameters
$str : string
$index : int
Return values
int

encode()

Returns the VLQ encoded value.

public static encode(int $value) : string
Parameters
$value : int
Return values
string

fromVLQSigned()

Converts to a two-complement value from a value where the sign bit is is placed in the least significant bit. For example, as decimals: 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 4 (100 binary) becomes 2, 5 (101 binary) becomes -2

private static fromVLQSigned(int $value) : int
Parameters
$value : int
Return values
int

toVLQSigned()

Converts from a two-complement value to a value where the sign bit is is placed in the least significant bit. For example, as decimals: 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)

private static toVLQSigned(int $value) : int
Parameters
$value : int
Return values
int

Search results