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

Function _writeUInt32

MathBox/mathbox-core.js:1646–1663  ·  view source on GitHub ↗
(buf, value, offset, littleEndian, noAssert)

Source from the content-addressed store, hash-verified

1644}
1645
1646function _writeUInt32 (buf, value, offset, littleEndian, noAssert) {
1647 if (!noAssert) {
1648 assert(value !== undefined && value !== null, 'missing value')
1649 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
1650 assert(offset !== undefined && offset !== null, 'missing offset')
1651 assert(offset + 3 < buf.length, 'trying to write beyond buffer length')
1652 verifuint(value, 0xffffffff)
1653 }
1654
1655 var len = buf.length
1656 if (offset >= len)
1657 return
1658
1659 for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {
1660 buf[offset + i] =
1661 (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
1662 }
1663}
1664
1665Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) {
1666 _writeUInt32(this, value, offset, true, noAssert)

Callers 2

mathbox-core.jsFile · 0.70
_writeInt32Function · 0.70

Calls 2

assertFunction · 0.70
verifuintFunction · 0.70

Tested by

no test coverage detected