diff options
| author | Heinrich Schuchardt <[email protected]> | 2024-11-03 23:42:20 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-11-13 08:14:23 -0600 |
| commit | 8ff37ec010ee228c0f7627b43e225103d9f460db (patch) | |
| tree | 90806f53aa4442ab5f94d6b1878240a7a8345a5c /include | |
| parent | e2635570e08199bb5644ce164def2a46d1dee9c0 (diff) | |
lib: provide function hextoull()
We often convert hexadecimal strings to hextoull(). Provide a wrapper
function to simple_strtoull() that does not require specifying the radix.
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Patrick Delaunay <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/vsprintf.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/vsprintf.h b/include/vsprintf.h index fe951471426..9da6ce7cc4d 100644 --- a/include/vsprintf.h +++ b/include/vsprintf.h @@ -45,6 +45,19 @@ ulong simple_strtoul(const char *cp, char **endp, unsigned int base); unsigned long hextoul(const char *cp, char **endp); /** + * hex_strtoull - convert a string in hex to an unsigned long long + * + * @cp: The string to be converted + * @endp: Updated to point to the first character not converted + * Return: value decoded from string (0 if invalid) + * + * Converts a hex string to an unsigned long long. If there are invalid + * characters at the end these are ignored. In the worst case, if all characters + * are invalid, 0 is returned + */ +unsigned long long hextoull(const char *cp, char **endp); + +/** * dec_strtoul - convert a string in decimal to an unsigned long * * @cp: The string to be converted |
