Use templates to reduce the redundant number-lexing functions (#1963)

This commit is contained in:
Rangi
2026-05-21 17:13:09 -04:00
committed by GitHub
parent 1871b0a0b8
commit 48fcd9a0ca
8 changed files with 121 additions and 216 deletions
+2 -2
View File
@@ -21,7 +21,7 @@
#include "diagnostics.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "util.hpp" // UpperMap, isDigit
#include "util.hpp" // UpperMap, parseDigit
#include "gfx/main.hpp"
#include "gfx/png.hpp"
@@ -37,7 +37,7 @@ static void skipBlankSpace(std::string_view const &str, size_t &pos) {
}
static uint8_t toHex(char c1, char c2) {
return parseHexDigit(c1) * 16 + parseHexDigit(c2);
return parseDigit<16>(c1) * 16 + parseDigit<16>(c2);
}
static uint8_t singleToHex(char c) {