MCPcopy Create free account
hub / github.com/bitpay/bitcore-message / objectWriteUInt16

Function objectWriteUInt16

bitcore-message.js:1600–1606  ·  view source on GitHub ↗
(buf, value, offset, littleEndian)

Source from the content-addressed store, hash-verified

1598}
1599
1600function objectWriteUInt16 (buf, value, offset, littleEndian) {
1601 if (value < 0) value = 0xffff + value + 1
1602 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1603 buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1604 (littleEndian ? i : 1 - i) * 8
1605 }
1606}
1607
1608Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1609 value = +value

Callers 1

bitcore-message.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected