MCPcopy Index your code
hub / github.com/nodejs/node / readInt48LE

Function readInt48LE

lib/internal/buffer.js:362–375  ·  view source on GitHub ↗
(buf, offset = 0)

Source from the content-addressed store, hash-verified

360}
361
362function readInt48LE(buf, offset = 0) {
363 validateNumber(offset, 'offset');
364 const first = buf[offset];
365 const last = buf[offset + 5];
366 if (first === undefined || last === undefined)
367 boundsError(offset, buf.length - 6);
368
369 const val = buf[offset + 4] + last * 2 ** 8;
370 return (val | (val & 2 ** 15) * 0x1fffe) * 2 ** 32 +
371 first +
372 buf[++offset] * 2 ** 8 +
373 buf[++offset] * 2 ** 16 +
374 buf[++offset] * 2 ** 24;
375}
376
377function readInt40LE(buf, offset = 0) {
378 validateNumber(offset, 'offset');

Callers 1

readIntLEFunction · 0.85

Calls 1

boundsErrorFunction · 0.85

Tested by

no test coverage detected