summaryrefslogtreecommitdiff
path: root/utils/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/utils.h')
-rw-r--r--utils/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/utils.h b/utils/utils.h
index 3a0417008..8f3516e1d 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
+#include <assert.h>
#ifndef NOF_ELEMENTS
#define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
@@ -71,6 +72,17 @@ char *strcasestr(const char *haystack, const char *needle);
#endif
unsigned int wallclock(void);
+/**
+ * Return a hex digit for the given numerical value.
+ *
+ * \return character in range 0-9a-f
+ */
+inline static char digit2lowcase_hex(unsigned char digit) {
+ assert(digit < 16);
+ return "0123456789abcdef"[digit];
+}
+
+
/* Platform specific functions */
void die(const char * const error);
void warn_user(const char *warning, const char *detail);