(buf, value, offset, littleEndian, noAssert)
| 48373 | } |
| 48374 | |
| 48375 | function _writeInt16 (buf, value, offset, littleEndian, noAssert) { |
| 48376 | if (!noAssert) { |
| 48377 | assert(value !== undefined && value !== null, 'missing value') |
| 48378 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') |
| 48379 | assert(offset !== undefined && offset !== null, 'missing offset') |
| 48380 | assert(offset + 1 < buf.length, 'Trying to write beyond buffer length') |
| 48381 | verifsint(value, 0x7fff, -0x8000) |
| 48382 | } |
| 48383 | |
| 48384 | var len = buf.length |
| 48385 | if (offset >= len) |
| 48386 | return |
| 48387 | |
| 48388 | if (value >= 0) |
| 48389 | _writeUInt16(buf, value, offset, littleEndian, noAssert) |
| 48390 | else |
| 48391 | _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) |
| 48392 | } |
| 48393 | |
| 48394 | Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { |
| 48395 | _writeInt16(this, value, offset, true, noAssert) |
no test coverage detected