Merge pull request #9333 from protocolbuffers/test_417622470

Project import generated by Copybara
pull/9335/head
deannagarcia 3 years ago committed by GitHub
commit 01e84b1293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      js/experimental/runtime/kernel/reader.js

@ -97,19 +97,6 @@ function readSfixed64(bufferDecoder, start) {
return Int64.fromBits(lowBits, highBits);
}
/**
* Reads a sint32 value from the binary bytes encoded as varint.
* @param {!BufferDecoder} bufferDecoder Binary format encoded bytes.
* @param {number} start Start of the data.
* @return {number}
* @package
*/
function readSint32(bufferDecoder, start) {
const bits = bufferDecoder.getUnsignedVarint32At(start);
// Truncate upper bits and convert from zig zag to signd int
return (bits >>> 1) ^ -(bits & 0x01);
}
/**
* Reads a sint64 value from the binary bytes encoded as varint.
* @param {!BufferDecoder} bufferDecoder Binary format encoded bytes.
@ -125,6 +112,17 @@ function readSint64(bufferDecoder, start) {
return Int64.fromBits(decodedLowerBits, decodedUpperBits);
}
/**
* Reads a sint32 value from the binary bytes encoded as varint.
* @param {!BufferDecoder} bufferDecoder Binary format encoded bytes.
* @param {number} start Start of the data.
* @return {number}
* @package
*/
function readSint32(bufferDecoder, start) {
return readSint64(bufferDecoder, start).getLowBits();
}
/**
* Read a subarray of bytes representing a length delimited field.
* @param {!BufferDecoder} bufferDecoder Binary format encoded bytes.

Loading…
Cancel
Save