diff options
Diffstat (limited to 'src/common/hex_util.h')
| -rw-r--r-- | src/common/hex_util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/hex_util.h b/src/common/hex_util.h index a00904939..618f53152 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <string> | 9 | #include <string> |
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include <fmt/format.h> | 11 | #include <fmt/format.h> |
| 12 | #include "common/assert.h" | ||
| 12 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 13 | 14 | ||
| 14 | namespace Common { | 15 | namespace Common { |
| @@ -29,6 +30,8 @@ namespace Common { | |||
| 29 | 30 | ||
| 30 | template <std::size_t Size, bool le = false> | 31 | template <std::size_t Size, bool le = false> |
| 31 | [[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) { | 32 | [[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) { |
| 33 | ASSERT_MSG(Size * 2 <= str.size(), "Invalid string size"); | ||
| 34 | |||
| 32 | std::array<u8, Size> out{}; | 35 | std::array<u8, Size> out{}; |
| 33 | if constexpr (le) { | 36 | if constexpr (le) { |
| 34 | for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { | 37 | for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { |