MCPcopy Index your code
hub / github.com/awayjs/core / writeInt

Method writeInt

lib/utils/ByteArray.ts:282–299  ·  view source on GitHub ↗
(b: number)

Source from the content-addressed store, hash-verified

280 }
281
282 public writeInt(b: number): void {
283 this.ensureWriteableSpace(4);
284
285 if ((this.position & 3) == 0) {
286 const view = new Int32Array(this.arraybytes);
287 view[ this.position >> 2 ] = (~~b); // ~~ is cast to int in js...
288 } else {
289 const view = new Int32Array(this.unalignedarraybytestemp, 0, 1);
290 view[0] = (~~b);
291 const view2 = new Uint8Array(this.arraybytes, this.position, 4);
292 const view3 = new Uint8Array(this.unalignedarraybytestemp, 0, 4);
293 view2.set(view3);
294 }
295 this.position += 4;
296
297 if (this.position > this.length)
298 this.length = this.position;
299 }
300
301 public readUnsignedInt(): number {
302 if (this.position > this.length + 4)

Callers 1

writeUTFBytesMethod · 0.95

Calls 2

ensureWriteableSpaceMethod · 0.95
setMethod · 0.80

Tested by

no test coverage detected