diff --git a/src/script_number.js b/src/script_number.js index 5177a8c..2c1a0ce 100644 --- a/src/script_number.js +++ b/src/script_number.js @@ -11,8 +11,6 @@ function decode (buffer, maxLength, minimal) { } } - var result - // 40-bit if (length === 5) { var a = buffer.readUInt32LE(0) @@ -22,6 +20,8 @@ function decode (buffer, maxLength, minimal) { return b * 0x100000000 + a } + var result = 0 + // 32-bit / 24-bit / 16-bit / 8-bit for (var i = 0; i < length; ++i) { result |= buffer[i] << (8 * i)