diff options
author | Andre Naujoks <nautsch2@gmail.com> | 2013-09-13 13:37:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-20 15:38:26 -0400 |
commit | c26d436cbf7a9549ec1073480a2e3f0d3f64e02d (patch) | |
tree | 6ba037fbde3d391864208ce94e2b61dc536bab10 /include/linux/kernel.h | |
parent | cc9fa74e2a195f7bab27fbbc4896d2fe3ec32150 (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/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 482ad2d84a32..672ddc4de4af 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -439,6 +439,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte) | |||
439 | return buf; | 439 | return buf; |
440 | } | 440 | } |
441 | 441 | ||
442 | extern const char hex_asc_upper[]; | ||
443 | #define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)] | ||
444 | #define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4] | ||
445 | |||
446 | static inline char *hex_byte_pack_upper(char *buf, u8 byte) | ||
447 | { | ||
448 | *buf++ = hex_asc_upper_hi(byte); | ||
449 | *buf++ = hex_asc_upper_lo(byte); | ||
450 | return buf; | ||
451 | } | ||
452 | |||
442 | static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) | 453 | static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) |
443 | { | 454 | { |
444 | return hex_byte_pack(buf, byte); | 455 | return hex_byte_pack(buf, byte); |