(bs)
| 5783 | |
| 5784 | // IO functions |
| 5785 | function writeBits(bs) |
| 5786 | { |
| 5787 | var value = bs[0]; |
| 5788 | var posval = bs[1]-1; |
| 5789 | while ( posval >= 0 ) { |
| 5790 | if (value & (1 << posval) ) { |
| 5791 | bytenew |= (1 << bytepos); |
| 5792 | } |
| 5793 | posval--; |
| 5794 | bytepos--; |
| 5795 | if (bytepos < 0) { |
| 5796 | if (bytenew == 0xFF) { |
| 5797 | writeByte(0xFF); |
| 5798 | writeByte(0); |
| 5799 | } |
| 5800 | else { |
| 5801 | writeByte(bytenew); |
| 5802 | } |
| 5803 | bytepos=7; |
| 5804 | bytenew=0; |
| 5805 | } |
| 5806 | } |
| 5807 | } |
| 5808 | |
| 5809 | function writeByte(value) |
| 5810 | { |
no test coverage detected