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

Method getBegin

projects/JavaScript/proto/protoex.js:1229–1248  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

1227 * @returns {!number} Field model begin offset
1228 */
1229 getBegin () {
1230 if ((this._buffer.offset + this.fbeOffset + this.fbeSize) > this._buffer.size) {
1231 return 0
1232 }
1233
1234 let fbeStructOffset = this.readUInt32(this.fbeOffset)
1235 console.assert((fbeStructOffset > 0) && ((this._buffer.offset + fbeStructOffset + 4 + 4) <= this._buffer.size), 'Model is broken!')
1236 if ((fbeStructOffset === 0) || ((this._buffer.offset + fbeStructOffset + 4 + 4) > this._buffer.size)) {
1237 return 0
1238 }
1239
1240 let fbeStructSize = this.readUInt32(fbeStructOffset)
1241 console.assert((fbeStructSize >= (4 + 4)), 'Model is broken!')
1242 if (fbeStructSize < (4 + 4)) {
1243 return 0
1244 }
1245
1246 this._buffer.shift(fbeStructOffset)
1247 return fbeStructOffset
1248 }
1249
1250 /**
1251 * Get the struct value (end phase)

Callers 2

getMethod · 0.95
onReceiveMethod · 0.45

Calls 2

readUInt32Method · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected