From 78b50f7261595ec645312353406df23e9c1274e4 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 16 Jun 2017 11:46:25 +0200 Subject: unpacknum: number can be 32bits --- src/lstrlib.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2