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

Method writeUnsignedInt

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

Source from the content-addressed store, hash-verified

261 }
262
263 public writeUnsignedInt(b: number): void {
264 this.ensureWriteableSpace(4);
265
266 if ((this.position & 3) == 0) {
267 const view = new Uint32Array(this.arraybytes);
268 view[ this.position >> 2 ] = (~~b) & 0xffffffff; // ~~ is cast to int in js...
269 } else {
270 const view = new Uint32Array(this.unalignedarraybytestemp, 0, 1);
271 view[0] = (~~b) & 0xffffffff;
272 const view2 = new Uint8Array(this.arraybytes, this.position, 4);
273 const view3 = new Uint8Array(this.unalignedarraybytestemp, 0, 4);
274 view2.set(view3);
275 }
276 this.position += 4;
277
278 if (this.position > this.length)
279 this.length = this.position;
280 }
281
282 public writeInt(b: number): void {
283 this.ensureWriteableSpace(4);

Callers

nothing calls this directly

Calls 2

ensureWriteableSpaceMethod · 0.95
setMethod · 0.80

Tested by

no test coverage detected