improve the bitwise coding/decoding