diff options
author | David Robillard <d@drobilla.net> | 2023-05-08 21:29:52 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-08 21:29:52 -0400 |
commit | 86894351ffb6cc7f9fd9a4d63ba0a6eecc64d29d (patch) | |
tree | cf08668affe83c2a0eb9c9e2eb16689c5b3517f6 /src/string_utils.h | |
parent | ed77fe14175e94138390f2ebf5348656e4421746 (diff) | |
download | serd-86894351ffb6cc7f9fd9a4d63ba0a6eecc64d29d.tar.gz serd-86894351ffb6cc7f9fd9a4d63ba0a6eecc64d29d.tar.bz2 serd-86894351ffb6cc7f9fd9a4d63ba0a6eecc64d29d.zip |
Avoid use of strtoul()
This function is overkill for the simple cases actually needed here, and pretty
slow anyway.
Diffstat (limited to 'src/string_utils.h')
-rw-r--r-- | src/string_utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
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) { |