apple1-videocard-lib/tools/wavconv/bytes2bits.js

12 lines
231 B
JavaScript

function bytesToBits(data) {
let bits = [];
data.forEach(byte => {
for(let t=7;t>=0;t--) {
let bit = (byte >> t) & 1;
bits.push(bit);
}
});
return bits;
}
module.exports = { bytesToBits };