summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-06-17 17:42:07 +1000
committerdaurnimator <quae@daurnimator.com>2017-06-17 17:42:07 +1000
commitdd9e8a96e3ec7a7698c36e3612fbda12d7de2d0f (patch)
treedfeb5594c2e8dc9d7fe89cd9251363dbcaaa8d5e
parentb32d8ec4d12f48ff4930f5b98b744661f974b0d4 (diff)
downloadfengari-dd9e8a96e3ec7a7698c36e3612fbda12d7de2d0f.tar.gz
fengari-dd9e8a96e3ec7a7698c36e3612fbda12d7de2d0f.tar.bz2
fengari-dd9e8a96e3ec7a7698c36e3612fbda12d7de2d0f.zip
src/lstrlib.js: a 'long' is 4 bytes in JS
-rw-r--r--src/lstrlib.js4
-rw-r--r--tests/test-suite/inprogress/tpack.js5
2 files changed, 4 insertions, 5 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 6cd4a80..b21690b 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -449,8 +449,8 @@ const getoption = function(h, fmt) {
case 'B'.charCodeAt(0): r.size = 1; r.opt = KOption.Kuint; return r;
case 'h'.charCodeAt(0): r.size = 2; r.opt = KOption.Kint; return r; // sizeof(short): 2
case 'H'.charCodeAt(0): r.size = 2; r.opt = KOption.Kuint; return r;
- case 'l'.charCodeAt(0): r.size = 8; r.opt = KOption.Kint; return r; // sizeof(long): 8
- case 'L'.charCodeAt(0): r.size = 8; r.opt = KOption.Kuint; return r;
+ case 'l'.charCodeAt(0): r.size = 4; r.opt = KOption.Kint; return r; // sizeof(long): 4
+ case 'L'.charCodeAt(0): r.size = 4; r.opt = KOption.Kuint; return r;
case 'j'.charCodeAt(0): r.size = 4; r.opt = KOption.Kint; return r; // sizeof(lua_Integer): 4
case 'J'.charCodeAt(0): r.size = 4; r.opt = KOption.Kuint; return r;
case 'T'.charCodeAt(0): r.size = 8; r.opt = KOption.Kuint; return r; // sizeof(size_t): 8
diff --git a/tests/test-suite/inprogress/tpack.js b/tests/test-suite/inprogress/tpack.js
index 64f0cc9..b5ae5a9 100644
--- a/tests/test-suite/inprogress/tpack.js
+++ b/tests/test-suite/inprogress/tpack.js
@@ -80,12 +80,11 @@ test("[test-suite] tpack: minimum behavior for integer formats", function (t) {
assert(unpack("h", pack("h", 0x7fff)) == 0x7fff)
assert(unpack("h", pack("h", -0x8000)) == -0x8000)
- -- TODO: JS mask will force a value between 0 and 255
- -- assert(unpack("L", pack("L", 0xffffffff)) == 0xffffffff)
+ assert(unpack("L", pack("L", 0xffffffff)) == 0xffffffff)
assert(unpack("l", pack("l", 0x7fffffff)) == 0x7fffffff)
assert(unpack("l", pack("l", -0x80000000)) == -0x80000000)
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {