summaryrefslogtreecommitdiff
path: root/src/lstrlib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-06-16 11:46:25 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-06-16 11:46:25 +0200
commit78b50f7261595ec645312353406df23e9c1274e4 (patch)
treef78b8df35b0e8c69d34f32b6e4660d746ab7296c /src/lstrlib.js
parent5cc20c902903418b6bfbca3d57542fee633a9368 (diff)
downloadfengari-78b50f7261595ec645312353406df23e9c1274e4.tar.gz
fengari-78b50f7261595ec645312353406df23e9c1274e4.tar.bz2
fengari-78b50f7261595ec645312353406df23e9c1274e4.zip
unpacknum: number can be 32bits
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r--src/lstrlib.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index a0e5911..248d245 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -749,7 +749,8 @@ const unpacknum = function(L, b, islittle, size) {
let dv = new DataView(new ArrayBuffer(size));
b.forEach((e, i) => dv.setUint8(i, e, islittle));
- return dv.getFloat64(0, islittle);
+ if (size == 4) return dv.getFloat32(0, islittle);
+ else return dv.getFloat64(0, islittle);
};
const str_unpack = function(L) {