From 86894351ffb6cc7f9fd9a4d63ba0a6eecc64d29d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 8 May 2023 21:29:52 -0400 Subject: Avoid use of strtoul() This function is overkill for the simple cases actually needed here, and pretty slow anyway. --- src/string_utils.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/string_utils.h') diff --git a/src/string_utils.h b/src/string_utils.h index 9ae0abcb..7770e1eb 100644 --- a/src/string_utils.h +++ b/src/string_utils.h @@ -89,6 +89,12 @@ serd_substrlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags); +static inline uint8_t +hex_digit_value(const uint8_t c) +{ + return (uint8_t)((c > '9') ? ((c & ~0x20) - 'A' + 10) : (c - '0')); +} + static inline char serd_to_upper(const char c) { -- cgit v1.2.1