MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / _writeInt16

Function _writeInt16

MathBox/mathbox-bundle.js:48375–48392  ·  view source on GitHub ↗
(buf, value, offset, littleEndian, noAssert)

Source from the content-addressed store, hash-verified

48373}
48374
48375function _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
48394Buffer.prototype.writeInt16LE = function (value, offset, noAssert) {
48395 _writeInt16(this, value, offset, true, noAssert)

Callers 1

mathbox-bundle.jsFile · 0.70

Calls 3

assertFunction · 0.70
verifsintFunction · 0.70
_writeUInt16Function · 0.70

Tested by

no test coverage detected