diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-15 14:57:13 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-15 14:57:13 +1100 |
commit | e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1 (patch) | |
tree | 49531b2a69c166ad193adddf50edbadb5e1a91a1 /src/ldump.js | |
parent | 6099ba186c38c854332ec483edd6cbca3cf94871 (diff) | |
parent | 8249248f80467f1660509a30623f40bb9ff1eba7 (diff) | |
download | fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.tar.gz fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.tar.bz2 fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.zip |
Merge branch 'Uint8Array'
Diffstat (limited to 'src/ldump.js')
-rw-r--r-- | src/ldump.js | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/ldump.js b/src/ldump.js index 964d6ff..7e62da3 100644 --- a/src/ldump.js +++ b/src/ldump.js @@ -34,31 +34,26 @@ const DumpByte = function(y, D) { }; const DumpInt = function(x, D) { - let dv = new DataView(new ArrayBuffer(4)); + let ab = new ArrayBuffer(4); + let dv = new DataView(ab); dv.setInt32(0, x, true); - let t = []; - for (let i = 0; i < 4; i++) - t.push(dv.getUint8(i, true)); - + let t = new Uint8Array(ab); DumpBlock(t, 4, D); }; const DumpInteger = function(x, D) { - let dv = new DataView(new ArrayBuffer(4)); + let ab = new ArrayBuffer(4); + let dv = new DataView(ab); dv.setInt32(0, x, true); - let t = []; - for (let i = 0; i < 4; i++) - t.push(dv.getUint8(i, true)); + let t = new Uint8Array(ab); DumpBlock(t, 4, D); }; const DumpNumber = function(x, D) { - let dv = new DataView(new ArrayBuffer(8)); + let ab = new ArrayBuffer(8); + let dv = new DataView(ab); dv.setFloat64(0, x, true); - let t = []; - for (let i = 0; i < 8; i++) - t.push(dv.getUint8(i, true)); - + let t = new Uint8Array(ab); DumpBlock(t, 8, D); }; |