(buf, offset, littleEndian, noAssert)
| 48227 | } |
| 48228 | |
| 48229 | function _readInt32 (buf, offset, littleEndian, noAssert) { |
| 48230 | if (!noAssert) { |
| 48231 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian') |
| 48232 | assert(offset !== undefined && offset !== null, 'missing offset') |
| 48233 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') |
| 48234 | } |
| 48235 | |
| 48236 | var len = buf.length |
| 48237 | if (offset >= len) |
| 48238 | return |
| 48239 | |
| 48240 | var val = _readUInt32(buf, offset, littleEndian, true) |
| 48241 | var neg = val & 0x80000000 |
| 48242 | if (neg) |
| 48243 | return (0xffffffff - val + 1) * -1 |
| 48244 | else |
| 48245 | return val |
| 48246 | } |
| 48247 | |
| 48248 | Buffer.prototype.readInt32LE = function (offset, noAssert) { |
| 48249 | return _readInt32(this, offset, true, noAssert) |
no test coverage detected