to_int() and parse_llong() taken from boost/hana/bool.hpp.
| 36 | namespace detail { |
| 37 | // to_int() and parse_llong() taken from boost/hana/bool.hpp. |
| 38 | constexpr int to_int(char c) |
| 39 | { |
| 40 | int result = 0; |
| 41 | |
| 42 | if (c >= 'A' && c <= 'F') { |
| 43 | result = static_cast<int>(c) - static_cast<int>('A') + 10; |
| 44 | } else if (c >= 'a' && c <= 'f') { |
| 45 | result = static_cast<int>(c) - static_cast<int>('a') + 10; |
| 46 | } else { |
| 47 | result = static_cast<int>(c) - static_cast<int>('0'); |
| 48 | } |
| 49 | |
| 50 | return result; |
| 51 | } |
| 52 | |
| 53 | template<std::size_t N> |
| 54 | constexpr long long parse_llong(const char (&arr)[N]) |