Created
August 9, 2021 19:43
-
-
Save blendin/2800609a34bafca93fa50169d080141a to your computer and use it in GitHub Desktop.
helpers.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Helpers { | |
| constructor() { | |
| this.buf = new ArrayBuffer(8); | |
| this.f64 = new Float64Array(this.buf); | |
| this.u32 = new Uint32Array(this.buf); | |
| } | |
| ftoil(f) { | |
| this.f64[0] = f; | |
| return this.u32[0] | |
| } | |
| ftoih(f) { | |
| this.f64[0] = f; | |
| return this.u32[1] | |
| } | |
| printhex(val) { | |
| console.log('0x' + val.toString(16)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment