aboutsummaryrefslogtreecommitdiff
path: root/include/vsprintf.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-10-14 12:48:07 -0600
committerTom Rini <trini@konsulko.com>2021-11-11 19:02:34 -0500
commit4a255ea3b65e7793eea97a90ad00dc2b59889683 (patch)
tree3d61765cb89672ba2cdab07ec363ca627827aeb0 /include/vsprintf.h
parent3bfb0f719a196558f909ca568f3803f86a190509 (diff)
downloadu-boot-4a255ea3b65e7793eea97a90ad00dc2b59889683.zip
u-boot-4a255ea3b65e7793eea97a90ad00dc2b59889683.tar.gz
u-boot-4a255ea3b65e7793eea97a90ad00dc2b59889683.tar.bz2
lib: Add a function to convert a string to a hex value
Add an xtoa() function, similar to itoa() but for hex instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com>
Diffstat (limited to 'include/vsprintf.h')
-rw-r--r--include/vsprintf.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/vsprintf.h b/include/vsprintf.h
index 4479df0..b474630 100644
--- a/include/vsprintf.h
+++ b/include/vsprintf.h
@@ -177,8 +177,8 @@ int vsprintf(char *buf, const char *fmt, va_list args);
* simple_itoa() - convert an unsigned integer to a string
*
* This returns a static string containing the decimal representation of the
- * given value. The returned value may be overwritten by other calls to the
- * same function, so should be used immediately
+ * given value. The returned value may be overwritten by other calls to other
+ * simple_... functions, so should be used immediately
*
* @val: Value to convert
* @return string containing the decimal representation of @val
@@ -186,6 +186,18 @@ int vsprintf(char *buf, const char *fmt, va_list args);
char *simple_itoa(ulong val);
/**
+ * simple_xtoa() - convert an unsigned integer to a hex string
+ *
+ * This returns a static string containing the hexadecimal representation of the
+ * given value. The returned value may be overwritten by other calls to other
+ * simple_... functions, so should be used immediately
+ *
+ * @val: Value to convert
+ * @return string containing the hexecimal representation of @val
+ */
+char *simple_xtoa(ulong num);
+
+/**
* Format a string and place it in a buffer
*
* @param buf The buffer to place the result into