UNPKG

mpegts-demuxer

Version:

Demuxes an MPEG Transport Stream into elementary packets.

25 lines (19 loc) 581 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.leftShift = leftShift; exports.rightShift = rightShift; exports.bitMask = bitMask; function leftShift(x, amount) { return x * 2 ** amount; } function rightShift(x, amount) { return Math.trunc(x / 2 ** amount); } // This is one of those rare applications where we actually need bitwise operators // as I don't know if there is a great way to do a bit mask without using `&` /* eslint-disable no-bitwise */ function bitMask(x, mask) { return x & mask; } /* eslint-enable no-bitwise */