aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndre Naujoks <nautsch2@gmail.com>2013-09-13 19:37:12 +0200
committerMister Oyster <oysterized@gmail.com>2017-04-11 10:57:15 +0200
commitc9b5a2213e0dd4b527020b13117bd144fef93018 (patch)
treea7faa6d3526b9628dbd4324438943adb95019345 /include/linux
parentb0f916ba19475cd51d1bd07932ed4ddf486332c7 (diff)
lib: introduce upper case hex ascii helpers
To be able to use the hex ascii functions in case sensitive environments the array hex_asc_upper[] and the needed functions for hex_byte_pack_upper() are introduced. Signed-off-by: Andre Naujoks <nautsch2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kernel.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 089774be8..b38b52483 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -455,6 +455,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
return buf;
}
+extern const char hex_asc_upper[];
+#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
+#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
+
+static inline char *hex_byte_pack_upper(char *buf, u8 byte)
+{
+ *buf++ = hex_asc_upper_hi(byte);
+ *buf++ = hex_asc_upper_lo(byte);
+ return buf;
+}
+
static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
{
return hex_byte_pack(buf, byte);