replace write_bit/flush_bits by write_bits

While reviewing performance, I identified the flushbits method as a bottleneck.

It's only used to group bits - written by several successive call to write_bit - in one octet.

Performance can be enhanced by testing if there is something to flush before each call to flushbits:

```
if ($this->bitcount) $this->flushbits();
```

But why not simply avoid it and just use a 'write_bits' method everywhere instead. 'write_bits' would directly write several bits grouped as one octet.

Performance without patch:
```
  1 000 messages =>    671,328 microsecs total /    101,430 microsecs for flushbits (35,124 calls)
 10 000 messages =>  6,802,054 microsecs total /  1,051,109 microsecs for flushbits (350,124 calls)
100 000 messages => 67,375,810 microsecs total / 10,245,146 microsecs for flushbits (3,500,124 calls)
```

Performance with patch (write_bits):
```
  1 000 messages =>    525,496 microsecs total
 10 000 messages =>  5,225,029 microsecs total
100 000 messages => 54,134,866 microsecs total
```