(bs)
| 5758 | |
| 5759 | // IO functions |
| 5760 | function writeBits(bs) |
| 5761 | { |
| 5762 | var value = bs[0]; |
| 5763 | var posval = bs[1]-1; |
| 5764 | while ( posval >= 0 ) { |
| 5765 | if (value & (1 << posval) ) { |
| 5766 | bytenew |= (1 << bytepos); |
| 5767 | } |
| 5768 | posval--; |
| 5769 | bytepos--; |
| 5770 | if (bytepos < 0) { |
| 5771 | if (bytenew == 0xFF) { |
| 5772 | writeByte(0xFF); |
| 5773 | writeByte(0); |
| 5774 | } |
| 5775 | else { |
| 5776 | writeByte(bytenew); |
| 5777 | } |
| 5778 | bytepos=7; |
| 5779 | bytenew=0; |
| 5780 | } |
| 5781 | } |
| 5782 | } |
| 5783 | |
| 5784 | function writeByte(value) |
| 5785 | { |
no test coverage detected