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
}
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)
}
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)
}
})
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'
})
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'
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