(out, olen, ol, count)
| 222 | // First five bits are code and Last three bits of codes represent length |
| 223 | const count_codes = new Uint8Array([0x01, 0x82, 0xc3, 0xe4, 0xf4]); |
| 224 | function encodeCount(out, olen, ol, count) { |
| 225 | for (var i = 0; i < 5; i++) { |
| 226 | if (count < count_adder[i]) { |
| 227 | ol = append_bits( |
| 228 | out, |
| 229 | olen, |
| 230 | ol, |
| 231 | count_codes[i] & 0xf8, |
| 232 | count_codes[i] & 0x07 |
| 233 | ); |
| 234 | var count16 = |
| 235 | (count - (i > 0 ? count_adder[i - 1] : 0)) << (16 - count_bit_lens[i]); |
| 236 | if (count_bit_lens[i] > 8) { |
| 237 | ol = append_bits(out, olen, ol, count16 >> 8, 8); |
| 238 | ol = append_bits(out, olen, ol, count16 & 0xff, count_bit_lens[i] - 8); |
| 239 | } else ol = append_bits(out, olen, ol, count16 >> 8, count_bit_lens[i]); |
| 240 | return ol; |
| 241 | } |
| 242 | } |
| 243 | return ol; |
| 244 | } |
| 245 | |
| 246 | const uni_bit_len = new Uint8Array([6, 12, 14, 16, 21]); |
| 247 | const uni_adder = [0, 64, 4160, 20544, 86080]; |
no test coverage detected