Skip to content

Instantly share code, notes, and snippets.

@cd789
Created August 14, 2021 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cd789/ebf4f2e2f17b5689e42f1849fd271523 to your computer and use it in GitHub Desktop.
Save cd789/ebf4f2e2f17b5689e42f1849fd271523 to your computer and use it in GitHub Desktop.
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