From edec2defbef0b5522a6d4fba12d8a6eda1aa86b5 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 8 Feb 2017 16:25:30 -0800 Subject: [PATCH] standard --- index.js | 6 +++--- test/write.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 5dea89c..a7017e9 100644 --- a/index.js +++ b/index.js @@ -1006,7 +1006,7 @@ function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) } return res } @@ -1312,7 +1312,7 @@ Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, no value = +value offset = offset >>> 0 if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) + var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } @@ -1335,7 +1335,7 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no value = +value offset = offset >>> 0 if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) + var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } diff --git a/test/write.js b/test/write.js index 9c10368..f6fc9f3 100644 --- a/test/write.js +++ b/test/write.js @@ -29,7 +29,7 @@ test('writeUint8 with a negative number throws', function (t) { }) test('hex of write{Uint,Int}{8,16,32}{LE,BE}', function (t) { - t.plan(2 * (2 * 2 * 2 + 2)) + t.plan(2 * ((2 * 2 * 2) + 2)) var hex = [ '03', '0300', '0003', '03000000', '00000003', 'fd', 'fdff', 'fffd', 'fdffffff', 'fffffffd' @@ -65,7 +65,7 @@ test('hex of write{Uint,Int}{8,16,32}{LE,BE}', function (t) { }) test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) { - t.plan(3 * (2 * 2 * 2 + 2)) + t.plan(3 * ((2 * 2 * 2) + 2)) var hex = [ '', '03', '00', '030000', '000000', '', 'fd', 'ff', 'fdffff', 'ffffff' @@ -84,7 +84,7 @@ test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) { for (var k = 0; k < endianesses.length; k++) { var z = endianesses[k] - var v1 = new B(y / 8 - 1) + var v1 = new B((y / 8) - 1) var next = new B(4) next.writeUInt32BE(0, 0) var writefn = 'write' + x + y + z -- 2.34.1