MCPcopy Create free account
hub / github.com/apache/fory / readVarUint36Small

Method readVarUint36Small

javascript/packages/core/lib/reader/index.ts:399–423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

397 }
398
399 readVarUint36Small(): number {
400 const readIdx = this.cursor;
401 if (this.byteLength - readIdx > 0) {
402 const value = this.dataView.getUint8(readIdx);
403 if ((value & 0x80) === 0) {
404 this.cursor = readIdx + 1;
405 return value;
406 }
407 }
408 if (this.byteLength - readIdx >= 5) {
409 const fourByteValue = this.dataView.getUint32(readIdx, true);
410 this.cursor = readIdx + 1;
411 let result = fourByteValue & 0x7f;
412 if ((fourByteValue & 0x80) !== 0) {
413 this.cursor++;
414 result |= (fourByteValue >>> 1) & 0x3f80;
415 if ((fourByteValue & 0x8000) !== 0) {
416 return this.continueReadVarUint36(readIdx + 2, fourByteValue, result);
417 }
418 }
419 return result;
420 } else {
421 return this.readVarUint36Slow();
422 }
423 }
424
425 private continueReadVarUint36(
426 readIdx: number,

Callers 2

stringWithHeaderMethod · 0.95
io.test.tsFile · 0.45

Calls 2

continueReadVarUint36Method · 0.95
readVarUint36SlowMethod · 0.95

Tested by

no test coverage detected