| 39 | 0x64, 0x64, 0x64, 0x64}; |
| 40 | |
| 41 | std::array<char, 4> encode_triplet(uint8_t a, uint8_t b, uint8_t c) { |
| 42 | constexpr uint32_t SIX_BIT_MASK = 0b111111; |
| 43 | const uint32_t concat_bits = (a << 16) | (b << 8) | c; |
| 44 | const auto x = encode_table[(concat_bits >> 18) & SIX_BIT_MASK]; |
| 45 | const auto y = encode_table[(concat_bits >> 12) & SIX_BIT_MASK]; |
| 46 | const auto z = encode_table[(concat_bits >> 6) & SIX_BIT_MASK]; |
| 47 | const auto w = encode_table[concat_bits & SIX_BIT_MASK]; |
| 48 | return {x, y, z, w}; |
| 49 | } |
| 50 | |
| 51 | std::array<uint8_t, 3> decode_quad(char a, char b, char c, char d) { |
| 52 | constexpr uint32_t BYTE_MASK = 0xff; |