(buf, offset, littleEndian, noAssert)
| 1542 | } |
| 1543 | |
| 1544 | function _readInt32 (buf, offset, littleEndian, noAssert) { |
| 1545 | if (!noAssert) { |
| 1546 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') |
| 1547 | assert(offset !== undefined && offset !== null, 'missing offset') |
| 1548 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') |
| 1549 | } |
| 1550 | |
| 1551 | var len = buf.length |
| 1552 | if (offset >= len) |
| 1553 | return |
| 1554 | |
| 1555 | var val = _readUInt32(buf, offset, littleEndian, true) |
| 1556 | var neg = val & 0x80000000 |
| 1557 | if (neg) |
| 1558 | return (0xffffffff - val + 1) * -1 |
| 1559 | else |
| 1560 | return val |
| 1561 | } |
| 1562 | |
| 1563 | Buffer.prototype.readInt32LE = function (offset, noAssert) { |
| 1564 | return _readInt32(this, offset, true, noAssert) |
no test coverage detected