MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / getBegin

Method getBegin

projects/JavaScript/proto/enums.js:4612–4631  ·  view source on GitHub ↗

* Get the struct value (begin phase) * @this {!FieldModelEnums} * @returns {!number} Field model begin offset

()

Source from the content-addressed store, hash-verified

4610 * @returns {!number} Field model begin offset
4611 */
4612 getBegin () {
4613 if ((this._buffer.offset + this.fbeOffset + this.fbeSize) > this._buffer.size) {
4614 return 0
4615 }
4616
4617 let fbeStructOffset = this.readUInt32(this.fbeOffset)
4618 console.assert((fbeStructOffset > 0) && ((this._buffer.offset + fbeStructOffset + 4 + 4) <= this._buffer.size), 'Model is broken!')
4619 if ((fbeStructOffset === 0) || ((this._buffer.offset + fbeStructOffset + 4 + 4) > this._buffer.size)) {
4620 return 0
4621 }
4622
4623 let fbeStructSize = this.readUInt32(fbeStructOffset)
4624 console.assert((fbeStructSize >= (4 + 4)), 'Model is broken!')
4625 if (fbeStructSize < (4 + 4)) {
4626 return 0
4627 }
4628
4629 this._buffer.shift(fbeStructOffset)
4630 return fbeStructOffset
4631 }
4632
4633 /**
4634 * Get the struct value (end phase)

Callers 3

getMethod · 0.95
test_create.jsFile · 0.45
create.jsFile · 0.45

Calls 2

readUInt32Method · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected