From 21b38babb024b8afde77fa8c65fe713265c52c94 Mon Sep 17 00:00:00 2001 From: Pierre VIGIER Date: Wed, 31 Aug 2016 10:46:22 +0800 Subject: [PATCH] Small "bug" in embedded js packer -128, -32768, -2147483648 are encoded differently than other engine, and not consistenly with -32 --- js/msgpack.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/msgpack.js b/js/msgpack.js index 08f5de6bf..281ce7a75 100644 --- a/js/msgpack.js +++ b/js/msgpack.js @@ -98,12 +98,12 @@ function encode(rv, // @param ByteArray: result // int if (mix >= -32) { // negative fixnum rv.push(0xe0 + mix + 32); - } else if (mix > -0x80) { + } else if (mix >= -0x80) { rv.push(0xd0, mix + 0x100); - } else if (mix > -0x8000) { + } else if (mix >= -0x8000) { mix += 0x10000; rv.push(0xd1, mix >> 8, mix & 0xff); - } else if (mix > -0x80000000) { + } else if (mix >= -0x80000000) { mix += 0x100000000; rv.push(0xd2, mix >>> 24, (mix >> 16) & 0xff, (mix >> 8) & 0xff, mix & 0xff);