| 14 | using ByteAsHex = std::array<char, 2>; |
| 15 | |
| 16 | constexpr std::array<ByteAsHex, 256> CreateByteToHexMap() |
| 17 | { |
| 18 | constexpr char hexmap[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
| 19 | |
| 20 | std::array<ByteAsHex, 256> byte_to_hex{}; |
| 21 | for (size_t i = 0; i < byte_to_hex.size(); ++i) { |
| 22 | byte_to_hex[i][0] = hexmap[i >> 4]; |
| 23 | byte_to_hex[i][1] = hexmap[i & 15]; |
| 24 | } |
| 25 | return byte_to_hex; |
| 26 | } |
| 27 | |
| 28 | } // namespace |
| 29 |