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

Method writeFloat

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

Source from the content-addressed store, hash-verified

318 }
319
320 public writeFloat(b: number): void {
321 this.ensureWriteableSpace(4);
322
323 if ((this.position & 3) == 0) {
324 const view = new Float32Array(this.arraybytes);
325 view[ this.position >> 2 ] = b;
326 } else {
327 const view = new Float32Array(this.unalignedarraybytestemp, 0, 1);
328 view[0] = b;
329 const view2 = new Uint8Array(this.arraybytes, this.position, 4);
330 const view3 = new Uint8Array(this.unalignedarraybytestemp, 0, 4);
331 view2.set(view3);
332 }
333 this.position += 4;
334
335 if (this.position > this.length)
336 this.length = this.position;
337 }
338
339 public readFloat(): number {
340 if (this.position > this.length + 4)

Callers

nothing calls this directly

Calls 2

ensureWriteableSpaceMethod · 0.95
setMethod · 0.80

Tested by

no test coverage detected