(bs)
| 5794 | |
| 5795 | // IO functions |
| 5796 | function writeBits(bs) |
| 5797 | { |
| 5798 | var value = bs[0]; |
| 5799 | var posval = bs[1]-1; |
| 5800 | while ( posval >= 0 ) { |
| 5801 | if (value & (1 << posval) ) { |
| 5802 | bytenew |= (1 << bytepos); |
| 5803 | } |
| 5804 | posval--; |
| 5805 | bytepos--; |
| 5806 | if (bytepos < 0) { |
| 5807 | if (bytenew == 0xFF) { |
| 5808 | writeByte(0xFF); |
| 5809 | writeByte(0); |
| 5810 | } |
| 5811 | else { |
| 5812 | writeByte(bytenew); |
| 5813 | } |
| 5814 | bytepos=7; |
| 5815 | bytenew=0; |
| 5816 | } |
| 5817 | } |
| 5818 | } |
| 5819 | |
| 5820 | function writeByte(value) |
| 5821 | { |
no test coverage detected