20 if (input.size() > std::numeric_limits<size_t>::max() / 8) {
25 const size_t encoded_length = (input.size() * 8 + 4) / 5;
26 output.reserve(encoded_length);
29 converter.Append(
static_cast<uint8_t
>(input[0]));
30 size_t next_byte_index = 1;
32 while (converter.CanExtract()) {
33 output.push_back(
kEncoding[converter.Extract()]);
34 if (converter.CanAppend() && next_byte_index < input.size()) {
35 converter.Append(
static_cast<uint8_t
>(input[next_byte_index++]));
39 if (converter.BitsAvailable() > 0) {
40 output.push_back(
kEncoding[converter.Peek()]);
43 return {
true, output};
48 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1,
49 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
50 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};